mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Extended cloudfront_facts module to have a predictable return value… (#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
This commit is contained in:
parent
ffa172e3a6
commit
9ba3b01ef0
1 changed files with 10 additions and 0 deletions
|
@ -238,6 +238,12 @@ summary:
|
||||||
description: Gives a summary of distributions, streaming distributions and origin access identities.
|
description: Gives a summary of distributions, streaming distributions and origin access identities.
|
||||||
returned: as default or if summary is true
|
returned: as default or if summary is true
|
||||||
type: dict
|
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
|
from ansible.module_utils.ec2 import get_aws_connection_info, ec2_argument_spec, boto3_conn, HAS_BOTO3
|
||||||
|
@ -545,6 +551,10 @@ class CloudFrontServiceManager:
|
||||||
|
|
||||||
def set_facts_for_distribution_id_and_alias(details, facts, distribution_id, aliases):
|
def set_facts_for_distribution_id_and_alias(details, facts, distribution_id, aliases):
|
||||||
facts[distribution_id].update(details)
|
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:
|
for alias in aliases:
|
||||||
facts[alias].update(details)
|
facts[alias].update(details)
|
||||||
return facts
|
return facts
|
||||||
|
|
Loading…
Reference in a new issue