From 5893d2fb44530afb32d0ef7d61454371d29c5fe6 Mon Sep 17 00:00:00 2001 From: Sergey Reshetnyak Date: Tue, 20 Dec 2016 19:44:32 +0300 Subject: [PATCH] Do not load meta if meta info is not provided For actions we can't provide meta info Change-Id: Ia3f65cbb985531b011c054e02407c0def05c009a --- fuel_ccp_entrypoint/start_script.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fuel_ccp_entrypoint/start_script.py b/fuel_ccp_entrypoint/start_script.py index c30da06..d27657a 100644 --- a/fuel_ccp_entrypoint/start_script.py +++ b/fuel_ccp_entrypoint/start_script.py @@ -95,7 +95,7 @@ def create_network_topology(meta_info, variables): {{ network_topology["public"]["iface"] }} """ - if meta_info["host-net"]: + if meta_info.get("host-net"): LOG.debug("Found 'host-net' flag, trying to fetch host network") priv_iface = variables["private_interface"] pub_iface = variables["public_interface"] @@ -444,9 +444,12 @@ def get_variables(role_name): LOG.info("Getting global variables from %s", GLOBALS_PATH) with open(GLOBALS_PATH) as f: variables = json.load(f) - LOG.info("Getting meta information from %s", META_FILE) - with open(META_FILE) as f: - meta_info = json.load(f) + if os.path.exists(META_FILE): + LOG.info("Getting meta information from %s", META_FILE) + with open(META_FILE) as f: + meta_info = json.load(f) + else: + meta_info = {} variables['role_name'] = role_name LOG.info("Get CCP environment variables") if os.environ.get('CCP_NODE_NAME'):