Skip to content

Commit

Permalink
Extended cloudfront_facts module to have a predictable return value… (a…
Browse files Browse the repository at this point in the history
…nsible#49061)

* Extended cloudfront_facts module to have a predictable return value for getting results.

* Updated RETURN docs with new field.

* Corrected the RETURN docs

* Fix typo in YAML
  • Loading branch information
stefanhorning authored and willthames committed Jun 10, 2019
1 parent ffa172e commit 9ba3b01
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/ansible/modules/cloud/amazon/cloudfront_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@
description: Gives a summary of distributions, streaming distributions and origin access identities.
returned: as default or if summary is true
type: dict
result:
description: >
Result dict not nested under the cloudfront id to access results of module without the knowledge of that id
as figuring out the DistributionId is usually the reason one uses this module in the first place.
returned: always
type: dict
'''

from ansible.module_utils.ec2 import get_aws_connection_info, ec2_argument_spec, boto3_conn, HAS_BOTO3
Expand Down Expand Up @@ -545,6 +551,10 @@ def keyed_list_helper(self, list_to_key):

def set_facts_for_distribution_id_and_alias(details, facts, distribution_id, aliases):
facts[distribution_id].update(details)
# also have a fixed key for accessing results/details returned
facts['result'] = details
facts['result']['DistributionId'] = distribution_id

for alias in aliases:
facts[alias].update(details)
return facts
Expand Down

0 comments on commit 9ba3b01

Please sign in to comment.