Don't error out on route53.list_tags_for_resource when resource has no tags

Without the added `return {}`, calling route53.list_tags_for_resource
when called with a ResourceId of a resource without any tags would
result in the error:
    jinja2.exceptions.UndefinedError: 'None' has no attribute 'items'

Because the LIST_TAGS_FOR_RESOURCE_RESPONSE was given None instead of
empty dict.

This now allows list_tags_for_resource to be called without issue on
tag-less resources.
This commit is contained in:
Don Kuntz 2019-08-28 13:55:19 -05:00
commit 35507f33df
No known key found for this signature in database
GPG key ID: 24499CE2571D5CEB
2 changed files with 8 additions and 0 deletions

View file

@ -305,6 +305,7 @@ class Route53Backend(BaseBackend):
def list_tags_for_resource(self, resource_id):
if resource_id in self.resource_tags:
return self.resource_tags[resource_id]
return {}
def get_all_hosted_zones(self):
return self.zones.values()