From 66e5427ffb42e7b445f0e093462712909a9cbc4d Mon Sep 17 00:00:00 2001 From: Sloane Hertel Date: Wed, 18 Sep 2019 09:58:58 -0400 Subject: [PATCH] cloudformation_info - fix KeyError (#62290) * cloudformation_info - fix KeyError * changelog --- .../fragments/62290-fix-cloudformation_info-KeyError.yaml | 2 ++ lib/ansible/modules/cloud/amazon/cloudformation_info.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/62290-fix-cloudformation_info-KeyError.yaml diff --git a/changelogs/fragments/62290-fix-cloudformation_info-KeyError.yaml b/changelogs/fragments/62290-fix-cloudformation_info-KeyError.yaml new file mode 100644 index 00000000000..6222b1bb304 --- /dev/null +++ b/changelogs/fragments/62290-fix-cloudformation_info-KeyError.yaml @@ -0,0 +1,2 @@ +bugfixes: + - cloudformation_info - Fix a KeyError returning information about the stack(s). diff --git a/lib/ansible/modules/cloud/amazon/cloudformation_info.py b/lib/ansible/modules/cloud/amazon/cloudformation_info.py index d3a1a628346..600470b3174 100644 --- a/lib/ansible/modules/cloud/amazon/cloudformation_info.py +++ b/lib/ansible/modules/cloud/amazon/cloudformation_info.py @@ -295,7 +295,10 @@ def main(): service_mgr = CloudFormationServiceManager(module) - result = {'ansible_facts': {'cloudformation': {}}} + if is_old_facts: + result = {'ansible_facts': {'cloudformation': {}}} + else: + result = {'cloudformation': {}} for stack_description in service_mgr.describe_stacks(module.params.get('stack_name')): facts = {'stack_description': stack_description}