From e45e25c2574edace9d4e55bf24d981c7fffcb645 Mon Sep 17 00:00:00 2001 From: Ryan Brown Date: Thu, 10 Nov 2016 11:32:32 -0500 Subject: [PATCH] Fix `cloudformation` error when stack-rollback fails (#5550) In cases where a CFN stack could not complete (due to lack of permissions or similar) but also failed to roll back, the gathering of stack resources would fail because successfully deleted items in the rollback would no longer have a `PhysicalResourceId` property. This PR fixes that by soft-failing when there's no physical ID associated to a resource. --- lib/ansible/modules/cloud/amazon/cloudformation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/amazon/cloudformation.py b/lib/ansible/modules/cloud/amazon/cloudformation.py index af7617c7db3..7785998e552 100644 --- a/lib/ansible/modules/cloud/amazon/cloudformation.py +++ b/lib/ansible/modules/cloud/amazon/cloudformation.py @@ -473,7 +473,7 @@ def main(): for res in reslist.get('StackResourceSummaries', []): stack_resources.append({ "logical_resource_id": res['LogicalResourceId'], - "physical_resource_id": res['PhysicalResourceId'], + "physical_resource_id": res.get('PhysicalResourceId', ''), "resource_type": res['ResourceType'], "last_updated_time": res['LastUpdatedTimestamp'], "status": res['ResourceStatus'],