From 85884df4baa9c1a0709b27108c8d3013c8637931 Mon Sep 17 00:00:00 2001 From: Keith Cantrell Date: Wed, 4 Sep 2024 19:08:54 -0500 Subject: [PATCH] Allowed it to handle it gracefully when the event is from a failed volume creation. --- .../auto_set_fsxn_auto_grow/set_fsxn_volume_auto_grow.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Management-Utilities/auto_set_fsxn_auto_grow/set_fsxn_volume_auto_grow.py b/Management-Utilities/auto_set_fsxn_auto_grow/set_fsxn_volume_auto_grow.py index ac518e9..740832b 100644 --- a/Management-Utilities/auto_set_fsxn_auto_grow/set_fsxn_volume_auto_grow.py +++ b/Management-Utilities/auto_set_fsxn_auto_grow/set_fsxn_volume_auto_grow.py @@ -137,6 +137,11 @@ def lambda_handler(event, context): logging.getLogger("boto3").setLevel(logging.WARNING) logging.getLogger("urllib3").setLevel(logging.WARNING) # + # If this is an event from a failed call. Report that and return. + if event['detail']['errorCode'] != None: + logger.warning(f"This is reporting on a error event. Error Code: {event['detail']['errorCode']}. Error Message: {event['detail']['errorMessage']}.") + return + # # Create a Secrets Manager client. session = boto3.session.Session() secretsManagerClient = session.client(service_name='secretsmanager', region_name=secretsManagerRegion)