-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Allow "aws cloudformation package" to succeed when a Resource is not a key-value pair #8096
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
Changes from 8 commits
2337581
1e80751
307056b
f7dcbb8
db8d728
d23436f
1e84495
8a9bab0
aeac7d1
b9ef4e0
10ae676
2a473b3
2584490
f171389
75cc5d7
8f3be23
7e7b8c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -659,9 +659,23 @@ def export(self): | |
|
|
||
| self.template_dict = self.export_global_artifacts(self.template_dict) | ||
|
|
||
| for resource_id, resource in self.template_dict["Resources"].items(): | ||
| self.export_resources(self.template_dict["Resources"]) | ||
|
|
||
| return self.template_dict | ||
|
|
||
| def export_resources(self, resource_dict): | ||
| for resource_id, resource in resource_dict.items(): | ||
|
|
||
| if resource_id.startswith("Fn::ForEach"): | ||
|
hssyoo marked this conversation as resolved.
Outdated
|
||
| if not isinstance(resource, list) or len(resource) < 3: | ||
|
hssyoo marked this conversation as resolved.
Outdated
|
||
| raise ValueError("Fn::ForEach with name {0} has invalid format".format(resource_id)) | ||
|
hssyoo marked this conversation as resolved.
Outdated
|
||
| if isinstance(resource[2], dict): | ||
|
hssyoo marked this conversation as resolved.
Outdated
|
||
| self.export_resources(resource[2]) | ||
| continue | ||
|
|
||
| resource_type = resource.get("Type", None) | ||
| if resource_type is None: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a particular reason this if check was added for the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had added this (removed it from the latest commit) to prevent the need to go through the items in resource_type = resource.get("Type", None)
# ...
for exporter_class in self.resources_to_export:
if exporter_class.RESOURCE_TYPE != resource_type:
continue
# ...However, looking at the |
||
| continue | ||
| resource_dict = resource.get("Properties", None) | ||
|
|
||
| for exporter_class in self.resources_to_export: | ||
|
|
@@ -671,5 +685,3 @@ def export(self): | |
| # Export code resources | ||
| exporter = exporter_class(self.uploader) | ||
| exporter.export(resource_id, resource_dict, self.template_dir) | ||
|
|
||
| return self.template_dict | ||
Uh oh!
There was an error while loading. Please reload this page.