1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix review comments from @bcoca in #745

This commit is contained in:
Toshio Kuratomi 2015-03-20 09:52:19 -07:00 committed by Matt Clay
parent 5378b5db98
commit e5149f3b30

View file

@ -225,19 +225,10 @@ def enforce_required_arguments(module):
def get_properties(autoscaling_group): def get_properties(autoscaling_group):
properties = dict((attr, getattr(autoscaling_group, attr)) for attr in ASG_ATTRIBUTES) properties = dict((attr, getattr(autoscaling_group, attr)) for attr in ASG_ATTRIBUTES)
# # Ugly hack to make this JSON-serializable. We take a list of boto Tag
# Ansible output is serialized to JSON but our # objects and replace them with a dict-representation. Needed because the
# tag list is sometimes a list of Tag-objects # tags are included in ansible's return value (which is jsonified)
# (as received by Boto). if 'tags' in properties and isinstance(properties['tags'], list):
#
# Since we can not easily teach python to serialize
# such a list we replace it with a dict-representation
# in those cases.
#
# Yes, this is an ugly hack. But at least it works,
# unlike the even uglier hack that was here previously...
#
if 'tags' in properties and properties['tags'] is list:
serializable_tags = {} serializable_tags = {}
for tag in properties['tags']: for tag in properties['tags']:
serializable_tags[tag.key] = [tag.value, tag.propagate_at_launch] serializable_tags[tag.key] = [tag.value, tag.propagate_at_launch]