@Test public void testUpdateRangerUrlConfigs() throws Exception { Map<String, String> oldHdfsProperties = new HashMap<String, String>(); Map<String, String> newHdfsProperties = new HashMap<String, String>(); oldHdfsProperties.put("ranger.plugin.hdfs.policy.rest.url", "{{policymgr_mgr_url}}"); newHdfsProperties.put("ranger.plugin.hdfs.policy.rest.url", "http: testUpdateRangerUrl(oldHdfsProperties, newHdfsProperties, "ranger-hdfs-security"); Map<String, String> oldHiveProperties = new HashMap<String, String>(); Map<String, String> newHiveProperties = new HashMap<String, String>(); oldHiveProperties.put("ranger.plugin.hive.policy.rest.url", "{{policymgr_mgr_url}}"); newHiveProperties.put("ranger.plugin.hive.policy.rest.url", "http: testUpdateRangerUrl(oldHiveProperties, newHiveProperties, "ranger-hive-security"); Map<String, String> oldHbaseProperties = new HashMap<String, String>(); Map<String, String> newHbaseProperties = new HashMap<String, String>(); oldHbaseProperties.put("ranger.plugin.hbase.policy.rest.url", "{{policymgr_mgr_url}}"); newHbaseProperties.put("ranger.plugin.hbase.policy.rest.url", "http: testUpdateRangerUrl(oldHbaseProperties, newHbaseProperties, "ranger-hbase-security"); Map<String, String> oldKnoxProperties = new HashMap<String, String>(); Map<String, String> newKnoxProperties = new HashMap<String, String>(); oldKnoxProperties.put("ranger.plugin.knox.policy.rest.url", "{{policymgr_mgr_url}}"); newKnoxProperties.put("ranger.plugin.knox.policy.rest.url", "http: testUpdateRangerUrl(oldKnoxProperties, newKnoxProperties, "ranger-knox-security"); Map<String, String> oldStormProperties = new HashMap<String, String>(); Map<String, String> newStormProperties = new HashMap<String, String>(); oldStormProperties.put("ranger.plugin.storm.policy.rest.url", "{{policymgr_mgr_url}}"); newStormProperties.put("ranger.plugin.storm.policy.rest.url", "http: testUpdateRangerUrl(oldStormProperties, newStormProperties, "ranger-storm-security"); Map<String, String> oldYarnProperties = new HashMap<String, String>(); Map<String, String> newYarnProperties = new HashMap<String, String>(); oldYarnProperties.put("ranger.plugin.yarn.policy.rest.url", "{{policymgr_mgr_url}}"); newYarnProperties.put("ranger.plugin.yarn.policy.rest.url", "http: testUpdateRangerUrl(oldYarnProperties, newYarnProperties, "ranger-yarn-security"); Map<String, String> oldKafkaProperties = new HashMap<String, String>(); Map<String, String> newKafkaProperties = new HashMap<String, String>(); oldKafkaProperties.put("ranger.plugin.kafka.policy.rest.url", "{{policymgr_mgr_url}}"); newKafkaProperties.put("ranger.plugin.kafka.policy.rest.url", "http: testUpdateRangerUrl(oldKafkaProperties, newKafkaProperties, "ranger-kafka-security"); Map<String, String> oldAtlasProperties = new HashMap<String, String>(); Map<String, String> newAtlasProperties = new HashMap<String, String>(); oldAtlasProperties.put("ranger.plugin.atlas.policy.rest.url", "{{policymgr_mgr_url}}"); newAtlasProperties.put("ranger.plugin.atlas.policy.rest.url", "http: testUpdateRangerUrl(oldAtlasProperties, newAtlasProperties, "ranger-atlas-security"); Map<String, String> oldKmsProperties = new HashMap<String, String>(); Map<String, String> newKmsProperties = new HashMap<String, String>(); oldKmsProperties.put("ranger.plugin.kms.policy.rest.url", "{{policymgr_mgr_url}}"); newKmsProperties.put("ranger.plugin.kms.policy.rest.url", "http: testUpdateRangerUrl(oldKmsProperties, newKmsProperties, "ranger-kms-security"); }
protected void updateRangerUrlConfigs() throws AmbariException { AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class); for (final Cluster cluster : getCheckedClusterMap(ambariManagementController.getClusters()).values()) { Config ranger_admin_properties = cluster.getDesiredConfigByType("admin-properties"); if(null != ranger_admin_properties) { String policyUrl = ranger_admin_properties.getProperties().get("policymgr_external_url"); if (null != policyUrl) { updateRangerUrl(cluster, "ranger-hdfs-security", "ranger.plugin.hdfs.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-hive-security", "ranger.plugin.hive.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-hbase-security", "ranger.plugin.hbase.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-knox-security", "ranger.plugin.knox.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-storm-security", "ranger.plugin.storm.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-yarn-security", "ranger.plugin.yarn.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-kafka-security", "ranger.plugin.kafka.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-atlas-security", "ranger.plugin.atlas.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-kms-security", "ranger.plugin.kms.policy.rest.url", policyUrl); } } } }
UpgradeCatalog250 extends AbstractUpgradeCatalog { protected void updateRangerUrlConfigs() throws AmbariException { AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class); for (final Cluster cluster : getCheckedClusterMap(ambariManagementController.getClusters()).values()) { Config ranger_admin_properties = cluster.getDesiredConfigByType("admin-properties"); if(null != ranger_admin_properties) { String policyUrl = ranger_admin_properties.getProperties().get("policymgr_external_url"); if (null != policyUrl) { updateRangerUrl(cluster, "ranger-hdfs-security", "ranger.plugin.hdfs.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-hive-security", "ranger.plugin.hive.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-hbase-security", "ranger.plugin.hbase.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-knox-security", "ranger.plugin.knox.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-storm-security", "ranger.plugin.storm.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-yarn-security", "ranger.plugin.yarn.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-kafka-security", "ranger.plugin.kafka.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-atlas-security", "ranger.plugin.atlas.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-kms-security", "ranger.plugin.kms.policy.rest.url", policyUrl); } } } } }
UpgradeCatalog250 extends AbstractUpgradeCatalog { protected void updateRangerUrlConfigs() throws AmbariException { AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class); for (final Cluster cluster : getCheckedClusterMap(ambariManagementController.getClusters()).values()) { Config ranger_admin_properties = cluster.getDesiredConfigByType("admin-properties"); if(null != ranger_admin_properties) { String policyUrl = ranger_admin_properties.getProperties().get("policymgr_external_url"); if (null != policyUrl) { updateRangerUrl(cluster, "ranger-hdfs-security", "ranger.plugin.hdfs.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-hive-security", "ranger.plugin.hive.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-hbase-security", "ranger.plugin.hbase.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-knox-security", "ranger.plugin.knox.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-storm-security", "ranger.plugin.storm.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-yarn-security", "ranger.plugin.yarn.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-kafka-security", "ranger.plugin.kafka.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-atlas-security", "ranger.plugin.atlas.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-kms-security", "ranger.plugin.kms.policy.rest.url", policyUrl); } } } } @Inject  UpgradeCatalog250(Injector injector); }
UpgradeCatalog250 extends AbstractUpgradeCatalog { protected void updateRangerUrlConfigs() throws AmbariException { AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class); for (final Cluster cluster : getCheckedClusterMap(ambariManagementController.getClusters()).values()) { Config ranger_admin_properties = cluster.getDesiredConfigByType("admin-properties"); if(null != ranger_admin_properties) { String policyUrl = ranger_admin_properties.getProperties().get("policymgr_external_url"); if (null != policyUrl) { updateRangerUrl(cluster, "ranger-hdfs-security", "ranger.plugin.hdfs.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-hive-security", "ranger.plugin.hive.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-hbase-security", "ranger.plugin.hbase.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-knox-security", "ranger.plugin.knox.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-storm-security", "ranger.plugin.storm.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-yarn-security", "ranger.plugin.yarn.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-kafka-security", "ranger.plugin.kafka.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-atlas-security", "ranger.plugin.atlas.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-kms-security", "ranger.plugin.kms.policy.rest.url", policyUrl); } } } } @Inject  UpgradeCatalog250(Injector injector); @Override String getTargetVersion(); @Override String getSourceVersion(); }
UpgradeCatalog250 extends AbstractUpgradeCatalog { protected void updateRangerUrlConfigs() throws AmbariException { AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class); for (final Cluster cluster : getCheckedClusterMap(ambariManagementController.getClusters()).values()) { Config ranger_admin_properties = cluster.getDesiredConfigByType("admin-properties"); if(null != ranger_admin_properties) { String policyUrl = ranger_admin_properties.getProperties().get("policymgr_external_url"); if (null != policyUrl) { updateRangerUrl(cluster, "ranger-hdfs-security", "ranger.plugin.hdfs.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-hive-security", "ranger.plugin.hive.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-hbase-security", "ranger.plugin.hbase.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-knox-security", "ranger.plugin.knox.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-storm-security", "ranger.plugin.storm.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-yarn-security", "ranger.plugin.yarn.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-kafka-security", "ranger.plugin.kafka.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-atlas-security", "ranger.plugin.atlas.policy.rest.url", policyUrl); updateRangerUrl(cluster, "ranger-kms-security", "ranger.plugin.kms.policy.rest.url", policyUrl); } } } } @Inject  UpgradeCatalog250(Injector injector); @Override String getTargetVersion(); @Override String getSourceVersion(); static final String COMPONENT_TABLE; static final String COMPONENT_VERSION_TABLE; static final String COMPONENT_VERSION_PK; static final String COMPONENT_VERSION_FK_COMPONENT; static final String COMPONENT_VERSION_FK_REPO_VERSION; }