fix return value (#25611)

document the returned
This commit is contained in:
Sloane Hertel 2017-06-13 09:18:58 -04:00 committed by GitHub
parent 9e8cc26720
commit 00d5de3dec

View file

@ -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: try:
import boto.ec2 import boto.ec2
import boto.vpc import boto.vpc
@ -82,7 +110,7 @@ class AnsibleIGWException(Exception):
def get_igw_info(igw): def get_igw_info(igw):
return {'id': igw.id, return {'gateway_id': igw.id,
'tags': igw.tags, 'tags': igw.tags,
'vpc_id': igw.vpc_id 'vpc_id': igw.vpc_id
} }
@ -215,7 +243,7 @@ def main():
except AnsibleIGWException as e: except AnsibleIGWException as e:
module.fail_json(msg=str(e)) module.fail_json(msg=str(e))
module.exit_json(**result) module.exit_json(changed=result['changed'], **result.get('gateway', {}))
if __name__ == '__main__': if __name__ == '__main__':