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

Some strings with leading 0s are converted from string to numbers #96

Open
alytle opened this issue Aug 28, 2020 · 4 comments
Open

Some strings with leading 0s are converted from string to numbers #96

alytle opened this issue Aug 28, 2020 · 4 comments
Assignees

Comments

@alytle
Copy link

alytle commented Aug 28, 2020

I ran into an interesting issue today. I have a SNS Subscription with a filter policy which uses a list of strings of numerical values to create filters. It looks something like this:

      FilterPolicy:
        FILTER_CODE:
          - "1234"
          - "0900"
          - "0500"

When the template is deployed, I end up with a template which looks like:

      FilterPolicy:
        FILTER_CODE:
          - "1234"
          - 900        <--- converted to an integer
          - "0500"     

I traced it to the cfn package command by adding a --verbose:

Syncing stack ...
StackName: ...
...
--- start of TemplateBody ---
AWSTemplateFormatVersion: '2010-09-09'
...
        FILTER_CODE:
        - '1234'
        - 0900
        - '0500'

So the number with a leading 0 was converted to a number, but not one which had a 0 followed by a 5. I traced the issue to a bug in the AWS CLI: aws/aws-cli#2934 - it was fixed apparently in AWS CLI v2 because they dropped pyyaml for ruamel according to aws/aws-cli#2934 (comment)

Since we are consuming awscli==1.18.97 we are still experiencing this.

Apparently the workaround is to use a trivial !Join [ "", "0900" ] which will prevent the incorrect parsing.

What would it take to move our code to awscli 2?

@Kotaimen
Copy link
Owner

Hi @alytle,

Sure, we'll take a look.

@GlieseRay please check whether our hack is broken by awscli2? I believe it makes sense to call awscli directly instead of hacking into their code.

@GlieseRay
Copy link
Collaborator

@Kotaimen @alytle Will take a look. we will definitely move to awscli2...

@GlieseRay GlieseRay self-assigned this Aug 29, 2020
@Kotaimen
Copy link
Owner

Kotaimen commented Aug 29, 2020

Hi @GlieseRay:

I did some very quick check, turns out awscli2 is not on pypi, the latest version is 1.18.121, seems AWS is pushing for a binary distribution for awscli v2... any thoughts...?

@GlieseRay
Copy link
Collaborator

Yes, and looks like they are not going to put it on pypi because of various reasons....

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

No branches or pull requests

3 participants