AMBARI-13792. Difference in configuration downloaded from UI and actual configuration files for Hive (dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/edefa485 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/edefa485 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/edefa485 Branch: refs/heads/trunk Commit: edefa4858ff95d82e742dbb86d2c48bbd34af2c2 Parents: a20d8f7 Author: Lisnichenko Dmitro <dlysniche...@hortonworks.com> Authored: Mon Nov 9 19:34:14 2015 +0200 Committer: Lisnichenko Dmitro <dlysniche...@hortonworks.com> Committed: Mon Nov 9 19:35:53 2015 +0200 ---------------------------------------------------------------------- .../ambari/server/actionmanager/ActionScheduler.java | 4 +++- .../controller/AmbariManagementControllerImpl.java | 4 +++- .../internal/ClientConfigResourceProvider.java | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/edefa485/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java index effd869..5415264 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java @@ -329,7 +329,9 @@ class ActionScheduler implements Runnable { for (ExecutionCommand cmd : commandsToSchedule) { // Hack - Remove passwords from configs - if (cmd.getRole().equals(Role.HIVE_CLIENT.toString()) && + if ((cmd.getRole().equals(Role.HIVE_CLIENT.toString()) || + cmd.getRole().equals(Role.WEBHCAT_SERVER.toString()) || + cmd.getRole().equals(Role.HCAT.toString())) && cmd.getConfigurations().containsKey(Configuration.HIVE_CONFIG_TAG)) { cmd.getConfigurations().get(Configuration.HIVE_CONFIG_TAG).remove(Configuration.HIVE_METASTORE_PASSWORD_PROPERTY); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edefa485/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java index 6a1e85c..49a8d8b 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java @@ -2558,7 +2558,9 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle StageUtils.getClusterHostInfo(cluster)); // Hack - Remove passwords from configs - if (ec.getRole().equals(Role.HIVE_CLIENT.toString()) && + if ((ec.getRole().equals(Role.HIVE_CLIENT.toString()) || + ec.getRole().equals(Role.WEBHCAT_SERVER.toString()) || + ec.getRole().equals(Role.HCAT.toString())) && ec.getConfigurations().containsKey(Configuration.HIVE_CONFIG_TAG)) { ec.getConfigurations().get(Configuration.HIVE_CONFIG_TAG).remove(Configuration.HIVE_METASTORE_PASSWORD_PROPERTY); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edefa485/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java index dea0362..43aba04 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java @@ -46,10 +46,12 @@ import org.apache.ambari.server.state.ComponentInfo; import org.apache.ambari.server.state.Config; import org.apache.ambari.server.state.ConfigHelper; import org.apache.ambari.server.state.DesiredConfig; +import org.apache.ambari.server.state.PropertyInfo; import org.apache.ambari.server.state.PropertyInfo.PropertyType; import org.apache.ambari.server.state.ServiceInfo; import org.apache.ambari.server.state.ServiceOsSpecific; import org.apache.ambari.server.state.StackId; +import org.apache.ambari.server.utils.SecretReference; import org.apache.ambari.server.utils.StageUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -206,6 +208,8 @@ public class ClientConfigResourceProvider extends AbstractControllerResourceProv Map<String, Map<String, String>> configurations = new TreeMap<String, Map<String, String>>(); + Map<String, Long> configVersions = new TreeMap<String, Long>(); + Map<String, Map<PropertyType, Set<String>>> configPropertiesTypes = new TreeMap<>(); Map<String, Map<String, Map<String, String>>> configurationAttributes = new TreeMap<String, Map<String, Map<String, String>>>(); Map<String, DesiredConfig> desiredClusterConfigs = cluster.getDesiredConfigs(); @@ -244,6 +248,8 @@ public class ClientConfigResourceProvider extends AbstractControllerResourceProv } configurations.put(clusterConfig.getType(), props); + configVersions.put(clusterConfig.getType(), clusterConfig.getVersion()); + configPropertiesTypes.put(clusterConfig.getType(), clusterConfig.getPropertiesTypes()); Map<String, Map<String, String>> attrs = new TreeMap<String, Map<String, String>>(); configHelper.cloneAttributesMap(clusterConfig.getPropertiesAttributes(), attrs); @@ -262,6 +268,15 @@ public class ClientConfigResourceProvider extends AbstractControllerResourceProv configurations.get(Configuration.HIVE_CONFIG_TAG).remove(Configuration.HIVE_METASTORE_PASSWORD_PROPERTY); } + // replace passwords on password references + for(Map.Entry<String, Map<String, String>> configEntry: configurations.entrySet()) { + String configType = configEntry.getKey(); + Map<String, String> configProperties = configEntry.getValue(); + Long configVersion = configVersions.get(configType); + Map<PropertyType, Set<String>> propertiesTypes = configPropertiesTypes.get(configType); + SecretReference.replacePasswordsWithReferences(propertiesTypes, configProperties, configType, configVersion); + } + Map<String, Set<String>> clusterHostInfo = null; ServiceInfo serviceInfo = null; String osFamily = null;