From 5dc8e2d5ca3539d7371c236456f368ba809ee682 Mon Sep 17 00:00:00 2001 From: Kristof Szabo Date: Tue, 4 Apr 2023 14:48:26 +0200 Subject: [PATCH] exception handling fix --- plugins/modules/backup_selection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/modules/backup_selection.py b/plugins/modules/backup_selection.py index 08d209fe58b..cef1b2cb139 100644 --- a/plugins/modules/backup_selection.py +++ b/plugins/modules/backup_selection.py @@ -268,8 +268,8 @@ def main(): ) if response_delete["ResponseMetadata"]["HTTPStatusCode"] == 200: changed = True - except Exception as e: - module.exit_json(changed=changed, failed=True) + except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: + module.fail_json_aws(e, msg="Failed to delete selection") # remove_peer_connection(client, module) formatted_results = camel_dict_to_snake_dict(response) # Turn the resource tags from boto3 into an ansible friendly tag dictionary