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

fix: Force strings to be outputted when string starts with 0 #1965

Merged
merged 4 commits into from
May 7, 2020

Conversation

jfuss
Copy link
Contributor

@jfuss jfuss commented May 6, 2020

Issue #, if available:
#867

Why is this change necessary?
When build outputs a template, the yaml dumper will omit the quotes when the number could not parse as a valid octal number. This will then lead to CFN stripping the 0 off the string (mostly accountids) and cause CFN stacks to fail.

How does it address the issue?
We will force the yaml dumper to output a string if there is a scalar with that starts with 0.

What side effects does this change have?
None that I know of

Did you change a dependency in requirements/base.txt?
If so, did you run make update-reproducible-reqs
N/A

Checklist:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

TAG_STR = "tag:yaml.org,2002:str"


def string_representer(dumper, value):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add a docstring here, just to explain what happens here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Callout, I meant to go back and completely forgot. Will get a new revision with that here soon.

@sriram-mv sriram-mv self-requested a review May 7, 2020 19:29
@sriram-mv sriram-mv merged commit 4a13f04 into aws:develop May 7, 2020
c2tarun added a commit to c2tarun/aws-sam-cli that referenced this pull request May 13, 2020
c2tarun added a commit that referenced this pull request May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants