From fbe03c296b6831620cac1284ffec042177ed6188 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Thu, 19 Oct 2023 19:22:16 +0200 Subject: [PATCH] s3_object - fix NoSuchTagSet error when S3 endpoint doesn't support tags (#1813) s3_object - fix NoSuchTagSet error when S3 endpoint doesn't support tags SUMMARY is_boto3_error_code only supports being passed a string or list. In the refactor of s3_object it was passed a tuple, so the errors weren't being cleanly caught. ISSUE TYPE Bugfix Pull Request COMPONENT NAME s3_object ADDITIONAL INFORMATION fixes: #1607 Reviewed-by: Alina Buzachis (cherry picked from commit 985d8b1cffb2bc2ee71f28afaad80612e7282d4a) --- changelogs/fragments/1607-NoSuchTagSet.yml | 2 ++ plugins/modules/s3_object.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/1607-NoSuchTagSet.yml diff --git a/changelogs/fragments/1607-NoSuchTagSet.yml b/changelogs/fragments/1607-NoSuchTagSet.yml new file mode 100644 index 00000000000..63aff3bb5c7 --- /dev/null +++ b/changelogs/fragments/1607-NoSuchTagSet.yml @@ -0,0 +1,2 @@ +bugfixes: +- s3_object - fixed ``NoSuchTagSet`` error when S3 endpoint doesn't support tags (https://github.com/ansible-collections/amazon.aws/issues/1607). diff --git a/plugins/modules/s3_object.py b/plugins/modules/s3_object.py index b7ab78e46f3..73eae84df84 100644 --- a/plugins/modules/s3_object.py +++ b/plugins/modules/s3_object.py @@ -957,7 +957,7 @@ def get_current_object_tags_dict(module, s3, bucket, obj, version=None): except is_boto3_error_code(IGNORE_S3_DROP_IN_EXCEPTIONS): module.warn("GetObjectTagging is not implemented by your storage provider.") return {} - except is_boto3_error_code(("NoSuchTagSet", "NoSuchTagSetError")): + except is_boto3_error_code(["NoSuchTagSet", "NoSuchTagSetError"]): return {} return boto3_tag_list_to_ansible_dict(current_tags)