fix remnants of list_ids being an async operation

This commit is contained in:
forest 2021-01-04 15:18:50 -06:00
parent 3fdd78df2e
commit 9fb6d58e1a
2 changed files with 12 additions and 17 deletions

View File

@ -27,20 +27,16 @@ def makeCapsulId():
return f"capsul-{lettersAndNumbers}"
def double_check_capsul_address(id, ipv4):
try:
result = current_app.config["HUB_MODEL"].get(id)
if result.ipv4 != ipv4:
ipv4 = result.ipv4
get_model().update_vm_ip(email=session["account"], id=id, ipv4=result.ipv4)
# try:
# result = current_app.config["HUB_MODEL"].get(id)
# if result.ipv4 != ipv4:
# ipv4 = result.ipv4
# get_model().update_vm_ip(email=session["account"], id=id, ipv4=result.ipv4)
# except:
# current_app.logger.error(f"""
# the virtualization model threw an error in double_check_capsul_address of {id}:
# {my_exec_info_message(sys.exc_info())}"""
# )
except:
current_app.logger.error(f"""
the virtualization model threw an error in double_check_capsul_address of {id}:
{my_exec_info_message(sys.exc_info())}"""
)
return ipv4

View File

@ -156,11 +156,10 @@ class CapsulFlaskHub(VirtualizationInterface):
all_valid = False
if not all_valid:
result_json_string = json.dumps({"error_message": "invalid capsul id returned"})
current_app.logger.error(f"""error reading ids for list_ids operation {operation_id}, host {host.id}""")
current_app.logger.error(f"""error reading ids for list_ids operation, host {host.id}""")
else:
result_json_string = json.dumps({"error_message": "invalid response, missing 'ids' list"})
get_model().update_host_operation(host.id, operation_id, "invalid_response_from_host", result_json_string)
current_app.logger.error(f"""missing 'ids' list for list_ids operation {operation_id}, host {host.id}""")
current_app.logger.error(f"""missing 'ids' list for list_ids operation, host {host.id}""")
except:
# no need to do anything here since if it cant be parsed then generic_operation will handle it.
pass