Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 29bac55b6 -> 486a40672
  refs/heads/trunk a20d8f73c -> edefa4858


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/486a4067
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/486a4067
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/486a4067

Branch: refs/heads/branch-2.1
Commit: 486a406723e26f917dce6cd17eddd091267dfc4d
Parents: 29bac55
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:34:14 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/486a4067/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 982bb15..3b489e5 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
@@ -328,7 +328,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/486a4067/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 1d922e2..c24b269 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
@@ -2548,7 +2548,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/486a4067/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;

Reply via email to