Преглед изворни кода

AMBARI-4314. API script for Storm and Falcon does not allow multinode
cluster testing (aonishuk)

Andrew Onischuk пре 11 година
родитељ
комит
0ecb08e4c0
1 измењених фајлова са 12 додато и 9 уклоњено
  1. 12 9
      ambari-server/src/main/resources/scripts/add_service_api.py

+ 12 - 9
ambari-server/src/main/resources/scripts/add_service_api.py

@@ -34,11 +34,12 @@ COMPONENTS = [
   "SUPERVISOR"
 ]
 
-COMPONENTS_TO_HOSTS = {
-  "NIMBUS": HOSTNAME,
-  "SUPERVISOR": HOSTNAME,
-  #"SUPERVISOR": "dev01.hortonworks.com"
-}
+COMPONENTS_TO_HOSTS = [
+  {"NIMBUS": HOSTNAME},
+  {"SUPERVISOR": HOSTNAME},
+  #{"SUPERVISOR": "c6402.ambari.apache.org"},
+  #{"SUPERVISOR": "c6403.ambari.apache.org"}
+]
 
 PROTOCOL = "http"
 PORT = "8080"
@@ -48,7 +49,8 @@ STACK_VERSION = "2.0.8"
 
 CONFIGS_TO_CHANGE = {
   "storm-site":{
-    "nimbus.host":HOSTNAME
+    #"storm.zookeeper.servers":"['c6401.amabri.apache.org','c6402.amabri.apache.org','c6403.amabri.apache.org']",
+    #"nimbus.host": "c6401.ambari.apache.org"
   },
   #"global":{
   #  "clientPort":"2182"
@@ -68,9 +70,10 @@ def main():
     checked_call('curl -H \'X-Requested-By:anything\' -i -X POST -d \'{{"components":[{{"ServiceComponentInfo":{{"component_name":"{component}"}}}}]}}\' -u admin:admin {server_url}/api/v1/clusters/{cluster_name}/services?ServiceInfo/service_name={service_name}'.
                format(service_name=SERVICE_NAME, component=component, server_url=SERVER_URL, cluster_name=CLUSTER_NAME))
     
-  # assign components to hosts 
-  for component, host in COMPONENTS_TO_HOSTS.iteritems():
-    checked_call('curl -H \'X-Requested-By:anything\' -i -X POST -d \'{{"host_components":[{{"HostRoles":{{"component_name":"{component}"}}}}]}}\' -u admin:admin {server_url}/api/v1/clusters/{cluster_name}/hosts?Hosts/host_name={host}'.
+  # assign components to hosts
+  for x in COMPONENTS_TO_HOSTS: 
+    for component, host in x.iteritems():
+      checked_call('curl -H \'X-Requested-By:anything\' -i -X POST -d \'{{"host_components":[{{"HostRoles":{{"component_name":"{component}"}}}}]}}\' -u admin:admin {server_url}/api/v1/clusters/{cluster_name}/hosts?Hosts/host_name={host}'.
                format(host=host, component=component, server_url=SERVER_URL, cluster_name=CLUSTER_NAME))
     
   # update and create all the service-specific configurations