From fd0d112834682bb6c371cf8dd131f4bcb1c36fd7 Mon Sep 17 00:00:00 2001 From: forest Date: Thu, 9 Dec 2021 13:19:42 -0600 Subject: [PATCH] fix get_all_by_host_and_network hub logic --- capsulflask/hub_model.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/capsulflask/hub_model.py b/capsulflask/hub_model.py index 3a8beb1..5abf174 100644 --- a/capsulflask/hub_model.py +++ b/capsulflask/hub_model.py @@ -177,12 +177,11 @@ class CapsulFlaskHub(VirtualizationInterface): has_hosts = isinstance(result_body, dict) and "hosts" in result_body and isinstance(result_body["hosts"], dict) has_current_host = has_hosts and isinstance(result_body["hosts"], dict) and host.id in result_body["hosts"] and isinstance(result_body["hosts"][host.id], dict) - has_networks = has_current_host and 'networks' in result_body["hosts"][host.id] and isinstance(result_body["hosts"][host.id]['networks'], dict) - if has_networks: - to_return[host.id] = result_body["hosts"][host.id]['networks'] + if has_current_host: + to_return[host.id] = result_body["hosts"][host.id] else: # result_json_string = json.dumps({"error_message": "invalid response, missing 'networks' list"}) - current_app.logger.error(f"""missing 'networks' list for get_all_by_host_and_network operation, host {host.id}""") + current_app.logger.error(f"""missing 'hosts' dict for get_all_by_host_and_network operation, host {host.id}""") except: # no need to do anything here since if it cant be parsed then generic_operation will handle it. pass