Browse Source

AMBARI-8867. Ensure that bluepint deployment sets each config type on cluster
no more than once

John Speidel 10 years ago
parent
commit
03463912a9

+ 12 - 6
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java

@@ -815,17 +815,23 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
     // create a list of config requests on a per-service basis, in order
     // to properly support the new service configuration versioning mechanism
     // in Ambari
+    Collection<String> encounteredConfigTypes = new HashSet<String>();
     for (String service : getServicesToDeploy(stack, blueprintHostGroups)) {
       BlueprintServiceConfigRequest blueprintConfigRequest =
         new BlueprintServiceConfigRequest(service);
 
       for (String serviceConfigType : stack.getConfigurationTypes(service)) {
-        // skip handling of cluster-env here
-        if (!serviceConfigType.equals("cluster-env")) {
-          if (mapClusterConfigurations.containsKey(serviceConfigType)) {
-            blueprintConfigRequest.addConfigElement(serviceConfigType,
-              mapClusterConfigurations.get(serviceConfigType),
-              mapClusterAttributes.get(serviceConfigType));
+        //todo: This is a temporary fix to ensure that we don't try to add the same
+        //todo: config type multiple times.
+        //todo: This is to unblock BUG-28939 and will be correctly fixed as part of BUG-29145.
+        if (encounteredConfigTypes.add(serviceConfigType)) {
+          // skip handling of cluster-env here
+          if (!serviceConfigType.equals("cluster-env")) {
+            if (mapClusterConfigurations.containsKey(serviceConfigType)) {
+              blueprintConfigRequest.addConfigElement(serviceConfigType,
+                mapClusterConfigurations.get(serviceConfigType),
+                mapClusterAttributes.get(serviceConfigType));
+            }
           }
         }
       }