Fix SQS tag list from CloudFormation resource creation (#3197)

* fix sqs tag list from cloudformation resource creation

the method `create_from_cloudformation_json` of the Sqs resource
does not handle the difference of format of the Tags field in the
resource template and the format expected in Sqs resource class.

In cfn resource template Tags is specified as a list of dicts. But
the Sqs resource expects that the tags field be a single dict.
This behaviour causes a crash when a queue is created with tags
from `create_from_cloudformation_json` and later the list_queue_tags
is called because it tries to call `items` from `queue.tags` but
tags is actually a list of dicts.

* fix comment

* fix linter

* minor

Co-authored-by: Hudo Assenco <hudo.assenco@gmail.com>
This commit is contained in:
Waldemar Hummer 2020-07-29 12:44:02 +02:00 committed by GitHub
commit 08a08b6af8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 3 deletions

View file

@ -356,3 +356,14 @@ def tags_from_query_string(
else:
response_values[tag_key] = None
return response_values
def tags_from_cloudformation_tags_list(tags_list):
"""Return tags in dict form from cloudformation resource tags form (list of dicts)"""
tags = {}
for entry in tags_list:
key = entry["Key"]
value = entry["Value"]
tags[key] = value
return tags