From ccb0af589f4075188b2db4776d3ab749e6a2eef7 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Fri, 20 Oct 2023 06:36:59 +0000 Subject: [PATCH] s3_object - fix NoSuchTagSet error when S3 endpoint doesn't support tags (#1813) (#1814) [PR #1813/985d8b1c backport][stable-6] s3_object - fix NoSuchTagSet error when S3 endpoint doesn't support tags This is a backport of PR #1813 as merged into main (985d8b1). 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: Mark Chappell --- 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)