fixed delete not working

This commit is contained in:
forest 2021-01-04 15:27:18 -06:00
parent 9fb6d58e1a
commit df7a750794

View File

@ -91,7 +91,10 @@ class CapsulFlaskHub(VirtualizationInterface):
pass pass
if not result_has_valid_status: if not result_has_valid_status:
current_app.logger.error(f"""error reading assignment_status for operation {operation_id} from host {host.id}: operation_desc = ""
if operation_id:
operation_desc = f"for operation {operation_id}"
current_app.logger.error(f"""error reading assignment_status {operation_desc} from host {host.id}:
result_is_json: {result_is_json} result_is_json: {result_is_json}
result_is_dict: {result_is_dict} result_is_dict: {result_is_dict}
result_has_status: {result_has_status} result_has_status: {result_has_status}
@ -155,7 +158,6 @@ class CapsulFlaskHub(VirtualizationInterface):
except: except:
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"})
current_app.logger.error(f"""error reading ids for list_ids operation, 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"})
@ -210,7 +212,7 @@ class CapsulFlaskHub(VirtualizationInterface):
result_status = None result_status = None
host = get_model().host_of_capsul(id) host = get_model().host_of_capsul(id)
if host is not None: if host is not None:
payload = json.dumps(dict(type="destroy", id=id)) payload = json.dumps(dict(type="destroy", email=email, id=id))
results = self.synchronous_operation([host], payload) results = self.synchronous_operation([host], payload)
result_json_string = "<no response from host>" result_json_string = "<no response from host>"
for result in results: for result in results:
@ -223,4 +225,4 @@ class CapsulFlaskHub(VirtualizationInterface):
pass pass
if not result_status == "success": if not result_status == "success":
raise ValueError(f"""failed to destroy vm "{id}" on host "{host}" for {email}: {result_json_string}""") raise ValueError(f"""failed to destroy vm "{id}" on host "{host.id}" for {email}: {result_json_string}""")