Repository: ambari
Updated Branches:
  refs/heads/branch-alerts-dev a4e97aaa2 -> f1018b176


AMBARI-7360. Deploying Ambari with custom users fails (aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ac290e25
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ac290e25
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ac290e25

Branch: refs/heads/branch-alerts-dev
Commit: ac290e25937baf6f4ccefde823a6ef84a5288aed
Parents: 24f0b47
Author: Andrew Onishuk <aonis...@hortonworks.com>
Authored: Wed Sep 17 16:44:11 2014 +0300
Committer: Andrew Onishuk <aonis...@hortonworks.com>
Committed: Wed Sep 17 16:44:11 2014 +0300

----------------------------------------------------------------------
 .../server/api/util/StackExtensionHelper.java   |  9 +++------
 .../ambari/server/state/ConfigHelper.java       | 21 ++++++++++++--------
 .../server/state/cluster/ClusterImpl.java       |  3 +--
 .../services/HDFS/configuration/hadoop-env.xml  |  2 +-
 4 files changed, 18 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ac290e25/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
index a63be38..3e211fe 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
@@ -749,8 +749,7 @@ public class StackExtensionHelper {
     ConfigurationXml configuration = unmarshal(ConfigurationXml.class, 
configFile);
     String fileName = configFile.getName();
     stackInfo.getProperties().addAll(getProperties(configuration, fileName));
-    int extIndex = 
fileName.indexOf(AmbariMetaInfo.SERVICE_CONFIG_FILE_NAME_POSTFIX);
-    String configType = fileName.substring(0, extIndex);
+    String configType = ConfigHelper.fileNameToConfigType(fileName);
 
     addConfigType(stackInfo.getConfigTypes(), configType);
     setConfigTypeAttributes(stackInfo.getConfigTypes(), configuration, 
configType);
@@ -797,8 +796,7 @@ public class StackExtensionHelper {
     ConfigurationXml configuration = unmarshal(ConfigurationXml.class, 
configFile);
     String fileName = configFile.getName();
     serviceInfo.getProperties().addAll(getProperties(configuration, fileName));
-    int extIndex = 
fileName.indexOf(AmbariMetaInfo.SERVICE_CONFIG_FILE_NAME_POSTFIX);
-    String configType = fileName.substring(0, extIndex);
+    String configType = ConfigHelper.fileNameToConfigType(fileName);
 
     addConfigType(serviceInfo.getConfigTypes(), configType);
     setConfigTypeAttributes(serviceInfo.getConfigTypes(), configuration, 
configType);
@@ -836,8 +834,7 @@ public class StackExtensionHelper {
     if (configurations != null) {
       Map<String, Map<String, Map<String, String>>> configTypes = new 
HashMap<String, Map<String, Map<String, String>>>();
       for (PropertyInfo configuration : configurations) {
-        int extIndex = 
configuration.getFilename().indexOf(AmbariMetaInfo.SERVICE_CONFIG_FILE_NAME_POSTFIX);
-        String configType = configuration.getFilename().substring(0, extIndex);
+        String configType = 
ConfigHelper.fileNameToConfigType(configuration.getFilename());
         
         if (!configTypes.containsKey(configType)) {
           Map<String, Map<String, String>> properties = new HashMap<String, 
Map<String, String>>();

http://git-wip-us.apache.org/repos/asf/ambari/blob/ac290e25/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java 
b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
index 790c177..191549b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
@@ -78,7 +78,7 @@ public class ConfigHelper {
     staleConfigsCache = CacheBuilder.newBuilder().
       expireAfterWrite(STALE_CONFIGS_CACHE_EXPIRATION_TIME, 
TimeUnit.SECONDS).build();
   }
-  
+
   /**
    * Gets the desired tags for a cluster and host
    * @param cluster the cluster
@@ -428,8 +428,7 @@ public class ConfigHelper {
       
       for (PropertyInfo stackProperty : stackProperties) {
         if(stackProperty.getName().equals(propertyName)) {
-          int extIndex = 
stackProperty.getFilename().indexOf(AmbariMetaInfo.SERVICE_CONFIG_FILE_NAME_POSTFIX);
-          String configType = stackProperty.getFilename().substring(0, 
extIndex);
+          String configType = 
fileNameToConfigType(stackProperty.getFilename());
           
           result.add(configType);
         }
@@ -447,10 +446,11 @@ public class ConfigHelper {
 
     for(Service service : cluster.getServices().values()) {
       Set<PropertyInfo> stackProperties = 
ambariMetaInfo.getProperties(stack.getName(), stack.getVersion(), 
service.getName());
-      
+
       for (PropertyInfo stackProperty : stackProperties) {
         if(stackProperty.getPropertyTypes().contains(propertyType)) {
-          result.add(stackProperty.getValue());
+          String stackPropertyConfigType = 
fileNameToConfigType(stackProperty.getFilename());
+          
result.add(cluster.getDesiredConfigByType(stackPropertyConfigType).getProperties().get(stackProperty.getName()));
         }
       }
     }
@@ -459,7 +459,8 @@ public class ConfigHelper {
     
     for (PropertyInfo stackProperty : stackProperties) {
       if(stackProperty.getPropertyTypes().contains(propertyType)) {
-        result.add(stackProperty.getValue());
+        String stackPropertyConfigType = 
fileNameToConfigType(stackProperty.getFilename());
+        
result.add(cluster.getDesiredConfigByType(stackPropertyConfigType).getProperties().get(stackProperty.getName()));
       }
     }
     
@@ -475,8 +476,7 @@ public class ConfigHelper {
       Set<PropertyInfo> stackProperties = 
ambariMetaInfo.getProperties(stack.getName(), stack.getVersion(), 
serviceInfo.getName());
       
       for (PropertyInfo stackProperty : stackProperties) {
-        int extIndex = 
stackProperty.getFilename().indexOf(AmbariMetaInfo.SERVICE_CONFIG_FILE_NAME_POSTFIX);
-        String stackPropertyConfigType = 
stackProperty.getFilename().substring(0, extIndex);
+        String stackPropertyConfigType = 
fileNameToConfigType(stackProperty.getFilename());
         
         if(stackProperty.getName().equals(propertyName) && 
stackPropertyConfigType.equals(configType)) {
           return stackProperty.getValue();
@@ -750,5 +750,10 @@ public class ConfigHelper {
   }
 
 
+  public static String fileNameToConfigType(String filename) {
+    int extIndex = 
filename.indexOf(AmbariMetaInfo.SERVICE_CONFIG_FILE_NAME_POSTFIX);
+    return filename.substring(0, extIndex);
+  }
+
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ac290e25/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
index 06f46fe..8914924 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
@@ -242,8 +242,7 @@ public class ClusterImpl implements Cluster {
       //collect config types for service
       Set<PropertyInfo> properties = 
ambariMetaInfo.getProperties(desiredStackVersion.getStackName(), 
desiredStackVersion.getStackVersion(), serviceName);
       for (PropertyInfo property : properties) {
-        int extIndex = 
property.getFilename().indexOf(AmbariMetaInfo.SERVICE_CONFIG_FILE_NAME_POSTFIX);
-        String configType = property.getFilename().substring(0, extIndex);
+        String configType = 
ConfigHelper.fileNameToConfigType(property.getFilename());
         if (serviceInfo.getExcludedConfigTypes() == null ||
           !serviceInfo.getExcludedConfigTypes().contains(configType)) {
           serviceConfigTypes.put(serviceName, configType);

http://git-wip-us.apache.org/repos/asf/ambari/blob/ac290e25/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HDFS/configuration/hadoop-env.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HDFS/configuration/hadoop-env.xml
 
b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HDFS/configuration/hadoop-env.xml
index 1de475e..5da6484 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HDFS/configuration/hadoop-env.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HDFS/configuration/hadoop-env.xml
@@ -62,12 +62,12 @@
     <description>DataNode maximum Java heap size</description>
   </property>
   <property>
-  <property>
     <name>proxyuser_group</name>
     <value>users</value>
     <property-type>GROUP</property-type>
     <description>Proxy user group.</description>
   </property>
+  <property>
     <name>hdfs_user</name>
     <value>hdfs</value>
     <property-type>USER</property-type>

Reply via email to