return success whn attempting to destroy a capsul that doesnt exist

This commit is contained in:
forest 2021-08-27 12:18:17 -05:00
parent f8e187ff84
commit 3346a45ed4

View File

@ -182,7 +182,10 @@ def handle_destroy(operation_id, request_body):
return abort(400, f"bad request; email is required for destroy") return abort(400, f"bad request; email is required for destroy")
try: try:
current_app.config['SPOKE_MODEL'].destroy(id=request_body['id'], email=request_body['email']) vm = current_app.config['SPOKE_MODEL'].get(request_body['id'], False)
current_app.logger.warning(f"destroy {request_body['id']} was called for {request_body['email']}, however the vm does not exist. returning success. ")
if vm is not None:
current_app.config['SPOKE_MODEL'].destroy(id=request_body['id'], email=request_body['email'])
except: except:
error_message = my_exec_info_message(sys.exc_info()) error_message = my_exec_info_message(sys.exc_info())
params = f"email='{request_body['email'] if 'email' in request_body else 'KeyError'}', " params = f"email='{request_body['email'] if 'email' in request_body else 'KeyError'}', "