Quellcode durchsuchen

AMBARI-5597. Rename host-groups in cluster create body to host_groups.

John Speidel vor 11 Jahren
Ursprung
Commit
08e726ada8

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

@@ -248,7 +248,7 @@ public class ClusterResourceProvider extends AbstractControllerResourceProvider
 
     // extract to own method
     baseUnsupported.remove("blueprint");
-    baseUnsupported.remove("host-groups");
+    baseUnsupported.remove("host_groups");
 
     return checkConfigPropertyIds(baseUnsupported, "Clusters");
   }
@@ -543,7 +543,7 @@ public class ClusterResourceProvider extends AbstractControllerResourceProvider
 
     @SuppressWarnings("unchecked")
     Collection<Map<String, Object>> hostGroups =
-        (Collection<Map<String, Object>>) properties.get("host-groups");
+        (Collection<Map<String, Object>>) properties.get("host_groups");
 
     // iterate over host groups provided in request body
     for (Map<String, Object> hostGroupProperties : hostGroups) {

+ 1 - 1
ambari-server/src/main/resources/scripts/cluster_blueprint.py

@@ -223,7 +223,7 @@ class AmbariBlueprint:
 
   def buildHostAssignments(self, blueprintName, blueprintJson, masters,
                            slaves, gateway = None):
-    hostAssignments = '{{"blueprint":"{0}","host-groups":[{1}]}}'
+    hostAssignments = '{{"blueprint":"{0}","host_groups":[{1}]}}'
     hostGroupHosts = '{{"name":"{0}","hosts":[{1}]}}'
     hosts = '{{"fqdn":"{0}"}},'
     logger.debug("Blueprint: {0}, Masters: {1}, Slaves: {2}".format(blueprintName, masters, slaves))

+ 1 - 1
ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java

@@ -241,7 +241,7 @@ public class ClusterResourceProviderTest {
     Map<String, String> hostGroupHostProperties = new HashMap<String, String>();
     hostGroupHostProperties.put("fqdn", "host.domain");
     hostGroupHosts.add(hostGroupHostProperties);
-    properties.put("host-groups", hostGroups);
+    properties.put("host_groups", hostGroups);
 
     Map<String, String> mapGroupConfigProperties = new HashMap<String, String>();
     mapGroupConfigProperties.put("myGroupProp", "awesomeValue");

+ 1 - 1
ambari-server/src/test/resources/TestAmbaryServer.samples/blueprint_hosts.json

@@ -1 +1 @@
-{"blueprint":"c1","host-groups":[{"name":"master","hosts":[{"fqdn":"host1"}]},{"name":"slaves","hosts":[{"fqdn":"host2"},{"fqdn":"host3"}]}]}
+{"blueprint":"c1","host_groups":[{"name":"master","hosts":[{"fqdn":"host1"}]},{"name":"slaves","hosts":[{"fqdn":"host2"},{"fqdn":"host3"}]}]}