From e3bff8b926aaf8a0737063fbc1a4e7bac888b0e9 Mon Sep 17 00:00:00 2001 From: Steve Pulec Date: Thu, 16 Mar 2017 21:19:53 -0400 Subject: [PATCH] Fix cloudformation NoValue parsing to not add attribute. Closes #870 --- moto/cloudformation/parsing.py | 6 +++++- .../test_cloudformation_stack_integration.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/moto/cloudformation/parsing.py b/moto/cloudformation/parsing.py index dafe30436..6d38289c7 100644 --- a/moto/cloudformation/parsing.py +++ b/moto/cloudformation/parsing.py @@ -158,7 +158,11 @@ def clean_json(resource_json, resources_map): cleaned_json = {} for key, value in resource_json.items(): - cleaned_json[key] = clean_json(value, resources_map) + cleaned_val = clean_json(value, resources_map) + if cleaned_val is None: + # If we didn't find anything, don't add this attribute + continue + cleaned_json[key] = cleaned_val return cleaned_json elif isinstance(resource_json, list): return [clean_json(val, resources_map) for val in resource_json] diff --git a/tests/test_cloudformation/test_cloudformation_stack_integration.py b/tests/test_cloudformation/test_cloudformation_stack_integration.py index e5d231865..2480ee051 100644 --- a/tests/test_cloudformation/test_cloudformation_stack_integration.py +++ b/tests/test_cloudformation/test_cloudformation_stack_integration.py @@ -382,6 +382,7 @@ def test_stack_elb_integration_with_update(): "Protocol": "HTTP", } ], + "Policies": {"Ref" : "AWS::NoValue"}, } }, },