From 00d5de3dec2b9a4bc53f3bdde59a485c6468c79d Mon Sep 17 00:00:00 2001 From: Sloane Hertel Date: Tue, 13 Jun 2017 09:18:58 -0400 Subject: [PATCH] fix return value (#25611) document the returned --- .../modules/cloud/amazon/ec2_vpc_igw.py | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_igw.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_igw.py index 7855a2f9c2..c45c00efd7 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_igw.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_igw.py @@ -62,6 +62,34 @@ register: igw ''' +RETURN = ''' +changed: + description: If any changes have been made to the Internet Gateway. + type: bool + returned: always + sample: + changed: false +gateway_id: + description: The unique identifier for the Internet Gateway. + type: str + returned: I(state=present) + sample: + gateway_id: "igw-XXXXXXXX" +tags: + description: The tags associated the Internet Gateway. + type: dict + returned: I(state=present) + sample: + tags: + "Ansible": "Test" +vpc_id: + description: The VPC ID associated with the Internet Gateway. + type: str + returned: I(state=present) + sample: + vpc_id: "vpc-XXXXXXXX" +''' + try: import boto.ec2 import boto.vpc @@ -82,7 +110,7 @@ class AnsibleIGWException(Exception): def get_igw_info(igw): - return {'id': igw.id, + return {'gateway_id': igw.id, 'tags': igw.tags, 'vpc_id': igw.vpc_id } @@ -215,7 +243,7 @@ def main(): except AnsibleIGWException as e: module.fail_json(msg=str(e)) - module.exit_json(**result) + module.exit_json(changed=result['changed'], **result.get('gateway', {})) if __name__ == '__main__':