From 9fd995aaf712cf3aa613c31a6a701d931c2063a6 Mon Sep 17 00:00:00 2001 From: Mustapha Unubi Momoh Date: Tue, 10 Dec 2024 08:06:28 -0500 Subject: [PATCH] Update deployment-support.yaml to fix `UnboundLocalError` (#669) --- aws/cloudformation-templates/deployment-support.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aws/cloudformation-templates/deployment-support.yaml b/aws/cloudformation-templates/deployment-support.yaml index 0d1d9b08b..11449a8e9 100644 --- a/aws/cloudformation-templates/deployment-support.yaml +++ b/aws/cloudformation-templates/deployment-support.yaml @@ -203,6 +203,7 @@ Resources: # exit while, success. break except URLError as e: + error = e retries += 1 print(f"Request failed. Retrying in 30 seconds... (Attempt {retries}/{max_retries})") print(f"Error: {e}") @@ -210,9 +211,9 @@ Resources: # if retries >= max_retries: - logger.error(f"Error calling product service init: {e.code} : {e.reason}") + logger.error(f"Error calling product service init: {error.reason}") response_status = cfnresponse.FAILED - response_data['Message'] = f"Resource {event['RequestType']} failed: {e}" + response_data['Message'] = f"Resource {event['RequestType']} failed: {error}" cfnresponse.send(event, context, response_status, response_data)