From b808e1bc5c95f5c6cb3e07f928bac5ce4c698ce5 Mon Sep 17 00:00:00 2001 From: Sloane Hertel Date: Wed, 17 Oct 2018 13:39:52 -0400 Subject: [PATCH] [s3_bucket] Cast tag keys and values to text to match the values returned (#46405) * Cast tag keys and values to text to match the values returned * changelog --- changelogs/fragments/s3_bucket_fix_non_str_tags.yaml | 5 +++++ lib/ansible/modules/cloud/amazon/s3_bucket.py | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 changelogs/fragments/s3_bucket_fix_non_str_tags.yaml diff --git a/changelogs/fragments/s3_bucket_fix_non_str_tags.yaml b/changelogs/fragments/s3_bucket_fix_non_str_tags.yaml new file mode 100644 index 0000000000..7a6e0e9f65 --- /dev/null +++ b/changelogs/fragments/s3_bucket_fix_non_str_tags.yaml @@ -0,0 +1,5 @@ +--- +bugfixes: + - s3_bucket - Prior to 2.6 using non-text tags worked, although was not idempotent. In 2.6 + waiters were introduced causing non-text tags to be fatal to the module's completion. + This fixes the module failure as well as idempotence using integers as tags. diff --git a/lib/ansible/modules/cloud/amazon/s3_bucket.py b/lib/ansible/modules/cloud/amazon/s3_bucket.py index e170d8538d..4ff462d203 100644 --- a/lib/ansible/modules/cloud/amazon/s3_bucket.py +++ b/lib/ansible/modules/cloud/amazon/s3_bucket.py @@ -230,6 +230,8 @@ def create_or_update_bucket(s3_client, module, location): module.fail_json_aws(e, msg="Failed to get bucket tags") if tags is not None: + # Tags are always returned as text + tags = dict((to_text(k), to_text(v)) for k, v in tags.items()) if current_tags_dict != tags: if tags: try: