diff options
author | Toshio Kuratomi <toshio@fedoraproject.org> | 2015-03-20 09:52:19 -0700 |
---|---|---|
committer | Toshio Kuratomi <toshio@fedoraproject.org> | 2015-03-20 09:52:19 -0700 |
commit | 5399f3744f0302ba9e5e076f792de8f74936577d (patch) | |
tree | 931637f68b92e3393c7d0d2ea546ab3d22da4e53 | |
parent | 9e9fa6a451b442ff8bc6a55b8c092cccd6daa57b (diff) | |
download | ansible-modules-core-m-o-e-fix-ec2_asg.tar.gz |
Fix review comments from @bcoca in #745m-o-e-fix-ec2_asg
-rw-r--r-- | cloud/amazon/ec2_asg.py | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/cloud/amazon/ec2_asg.py b/cloud/amazon/ec2_asg.py index 92025c2b..97d89d4c 100644 --- a/cloud/amazon/ec2_asg.py +++ b/cloud/amazon/ec2_asg.py @@ -225,19 +225,10 @@ def enforce_required_arguments(module): def get_properties(autoscaling_group): properties = dict((attr, getattr(autoscaling_group, attr)) for attr in ASG_ATTRIBUTES) - # - # Ansible output is serialized to JSON but our - # tag list is sometimes a list of Tag-objects - # (as received by Boto). - # - # 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: + # Ugly hack to make this JSON-serializable. We take a list of boto Tag + # objects and replace them with a dict-representation. Needed because the + # tags are included in ansible's return value (which is jsonified) + if 'tags' in properties and isinstance(properties['tags'], list): serializable_tags = {} for tag in properties['tags']: serializable_tags[tag.key] = [tag.value, tag.propagate_at_launch] |