Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes PhysicalResourceId KeyError when stack in ROLLBACK state #55990

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
2 participants
@denisra
Copy link
Contributor

commented May 1, 2019

SUMMARY

Fixes PhysicalResourceId KeyError when stack in ROLLBACK state

Fixes #38033

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

modules/cloud/amazon/cloudformation_facts.py

ADDITIONAL INFORMATION

Currently, if we try to get facts from a CloudFormation Stack that is in
ROLLBACK state, this module will throw a KeyError exception, given that the
PhysicalResourceId key does not exist for every resource in the
stack_resource_list. Using the dict get method would set the value to None
(null) if the key does not exist:

   "stack_resources": {
       "AppSecurityGroup": "sg-XXXXXXXXXX",
       "testawsngxLaunchConfig": null,
       "testawsngxLoadBalancer": "arn:aws:elasticloadbalancing:eu-west-1:XXXXXXXX:loadbalancer/net/test-test-1P5RFLQ266GGP/XXXXXXXXXXXX",
       "testawsngxTargetGroup": "arn:aws:elasticloadbalancing:eu-west-1:XXXXXXX:targetgroup/test-test-1LDHMLKNWNA82/XXXXXXXXXXXX"
   },
Denis Afonso
Fixes PhysicalResourceId KeyError when stack in ROLLBACK state
Currently, if we try to get facts from a CloudFormation Stack that is in
`ROLLBACK` state, this module will throw a `KeyError` exception, given that the
`PhysicalResourceId` key does not exist for every resource in the
stack_resource_list. Using the dict `get` method would set the value to None
(null) if the key does not exist:

```
   "stack_resources": {
       "AppSecurityGroup": "sg-XXXXXXXXXX",
       "testawsngxLaunchConfig": null,
       "testawsngxLoadBalancer": "arn:aws:elasticloadbalancing:eu-west-1:XXXXXXXX:loadbalancer/net/test-test-1P5RFLQ266GGP/XXXXXXXXXXXX",
       "testawsngxTargetGroup": "arn:aws:elasticloadbalancing:eu-west-1:XXXXXXX:targetgroup/test-test-1LDHMLKNWNA82/XXXXXXXXXXXX"
   },
```

Fixes issue #38033
@ansibot

This comment has been minimized.

Copy link
Contributor

commented May 1, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented May 1, 2019

@denisra, just so you are aware we have a dedicated Working Group for aws.
You can find other people interested in this in #ansible-aws on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.