launcher_service_server.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. """
  2. Licensed to the Apache Software Foundation (ASF) under one
  3. or more contributor license agreements. See the NOTICE file
  4. distributed with this work for additional information
  5. regarding copyright ownership. The ASF licenses this file
  6. to you under the Apache License, Version 2.0 (the
  7. "License"); you may not use this file except in compliance
  8. with the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. """
  16. # configure the VM to set Weave network, run Ambari-agent directly inside VM
  17. # argv 1: the external IP of this VM
  18. # argv 2: the Weave IP of the Ambari-server
  19. # argv 3: the external IP of the Ambari-server
  20. # argv 4: the name of the cluster
  21. from config import Config
  22. from cluster import Cluster
  23. import sys
  24. if __name__ == "__main__":
  25. if len(sys.argv) < 5:
  26. print "configure the VM to set Docker, Weave network, run Ambari-agent inside the Docker"
  27. print "Args: <the external IP of this VM>"
  28. print " <the Weave IP of the Ambari-server>"
  29. print " <the external IP of the Ambari-server>"
  30. print " <the name of the cluster>"
  31. exit(1)
  32. Config.load()
  33. my_external_ip = sys.argv[1]
  34. server_weave_ip = sys.argv[2]
  35. server_external_ip = sys.argv[3]
  36. cluster_name = sys.argv[4]
  37. cluster = Cluster.load_from_json(cluster_name)
  38. vm = cluster.get_service_server_vm(my_external_ip)
  39. vm.run_service_server(server_weave_ip, server_external_ip)