From 9ba3b01ef063cfaaada90e994a31f2f077a60203 Mon Sep 17 00:00:00 2001 From: Stefan Horning Date: Mon, 10 Jun 2019 11:23:06 +0200 Subject: [PATCH] =?UTF-8?q?Extended=20cloudfront=5Ffacts=20module=20to=20h?= =?UTF-8?q?ave=20a=20predictable=20return=20value=E2=80=A6=20(#49061)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- lib/ansible/modules/cloud/amazon/cloudfront_facts.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/ansible/modules/cloud/amazon/cloudfront_facts.py b/lib/ansible/modules/cloud/amazon/cloudfront_facts.py index 10896667e1..30303f6b28 100644 --- a/lib/ansible/modules/cloud/amazon/cloudfront_facts.py +++ b/lib/ansible/modules/cloud/amazon/cloudfront_facts.py @@ -238,6 +238,12 @@ summary: 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 @@ -545,6 +551,10 @@ class CloudFrontServiceManager: 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