diff options
author | asteroide <thomas.duval@orange.com> | 2017-09-21 16:58:20 +0200 |
---|---|---|
committer | asteroide <thomas.duval@orange.com> | 2017-09-21 16:58:20 +0200 |
commit | a955f144681d4a401cf8f64ff10561cec8bc0f8b (patch) | |
tree | 11a19d61e6bae8b95b795f8d029824b1a626f00d /moonv4 | |
parent | c9a6f3aa1e9bf6de81879adf1916fa26c4a01e74 (diff) |
Fix some bugs and delete MessageQueue startup
Change-Id: I380c1cd4c24bf5f9069561eb3f6141788042c3a3
Diffstat (limited to 'moonv4')
-rw-r--r-- | moonv4/bin/bootstrap.py | 46 |
1 files changed, 2 insertions, 44 deletions
diff --git a/moonv4/bin/bootstrap.py b/moonv4/bin/bootstrap.py index 85b3adfb..eb5c82ac 100644 --- a/moonv4/bin/bootstrap.py +++ b/moonv4/bin/bootstrap.py @@ -9,18 +9,12 @@ import base64 import mysql.connector import re import subprocess -# import pika -# import pika.credentials -# import pika.exceptions logging.basicConfig(level=logging.INFO) log = logging.getLogger("moon.bootstrap") requests_log = logging.getLogger("requests.packages.urllib3") requests_log.setLevel(logging.WARNING) requests_log.propagate = True -pika_log = logging.getLogger("pika") -pika_log.setLevel(logging.ERROR) -pika_log.propagate = True if len(sys.argv) == 2: if os.path.isfile(sys.argv[1]): @@ -167,40 +161,6 @@ def start_database(): break -def wait_for_message_queue(): - for messenger in get("messenger"): - url = messenger['url'] - match = re.search("(?P<proto>^[\\w+]+):\/\/(?P<user>\\w+):(?P<password>.+)@(?P<host>\\w+):?(?P<port>\\d*)/?(?P<virtual_host>\\w+)", - url) - config = match.groupdict() - while True: - try: - connection = pika.BlockingConnection( - pika.ConnectionParameters( - host=config['host'], - port=int(config['port']), - virtual_host=config['virtual_host'], - credentials=pika.credentials.PlainCredentials( - config['user'], - config['password'] - ) - ) - ) - connection.close() - except ( - pika.exceptions.ProbableAuthenticationError, - pika.exceptions.ConnectionClosed, - ConnectionResetError, - pika.exceptions.IncompatibleProtocolError - ): - log.info("Waiting for MessageQueue ({})".format(config["host"])) - time.sleep(1) - continue - else: - log.info("MessageQueue is up") - break - - def start_keystone(): output = subprocess.run(["docker", "run", "-dti", "--net=moon", "--hostname=keystone", "--name=keystone", "-e", "DB_HOST=db", "-e", "DB_PASSWORD_ROOT=p4sswOrd1", "-p", "35357:35357", @@ -214,6 +174,7 @@ def start_keystone(): for config in get("openstack/keystone"): while True: try: + time.sleep(1) req = requests.get(config["url"]) except requests.exceptions.ConnectionError: log.info("Waiting for Keystone ({})".format(config["url"])) @@ -252,14 +213,11 @@ def start_moon(data_config): def main(): data_config = search_config_file() - subprocess.run(["docker", "rm", "-f", "consul", "db", "manager", "wrapper", "interface", "authz*"]) + subprocess.run(["docker", "rm", "-f", "consul", "db", "manager", "wrapper", "interface", "authz*", "keystone"]) start_consul(data_config) start_database() start_keystone() start_moon(data_config) - # wait_for_message_queue() - # import moon_orchestrator.server - # moon_orchestrator.server.main() main() |