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}" return f"capsul-{lettersAndNumbers}"
def double_check_capsul_address(id, ipv4): def double_check_capsul_address(id, ipv4):
result = current_app.config["HUB_MODEL"].get(id) try:
if result.ipv4 != ipv4: result = current_app.config["HUB_MODEL"].get(id)
ipv4 = result.ipv4 if result.ipv4 != ipv4:
get_model().update_vm_ip(email=session["account"], id=id, ipv4=result.ipv4) ipv4 = result.ipv4
# try: get_model().update_vm_ip(email=session["account"], id=id, ipv4=result.ipv4)
# result = current_app.config["HUB_MODEL"].get(id) except:
# if result.ipv4 != ipv4: current_app.logger.error(f"""
# ipv4 = result.ipv4 the virtualization model threw an error in double_check_capsul_address of {id}:
# get_model().update_vm_ip(email=session["account"], id=id, ipv4=result.ipv4) {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 return ipv4

View File

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