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

Cfn-flip fails to parse YAMLs when there is a tab character #117

Open
JoseRolles opened this issue Jan 14, 2022 · 3 comments
Open

Cfn-flip fails to parse YAMLs when there is a tab character #117

JoseRolles opened this issue Jan 14, 2022 · 3 comments

Comments

@JoseRolles
Copy link

This doesn't work:

Parameters:
  Test:
    Type: String
    Default: Tab here ->	<- tab here
Resources:
  S3:
    Type: AWS::Logs::LogGroup

This works:

Parameters:
  Test:
    Type: String
    Default: "Tab here ->\t<- tab here"
Resources:
  S3:
    Type: AWS::Logs::LogGroup

When using AWS CloudFormation Designer, somehow it still validates without issue.

@koiker
Copy link
Collaborator

koiker commented Jan 18, 2022

Hi Jose,

Let me run some tests.

@koiker
Copy link
Collaborator

koiker commented Feb 11, 2022

I was able to replicate the issue and found that this is a bug in PyYaml accordingly to this thread: yaml/pyyaml#594
I will think in how we can solve this issue by:

  • Applying a fix locally to this project
  • Moving from PyYaml to a different library
  • Checking if PyYaml has solved this with a new version or if they will gonna solve this in a new version.

@w0rmr1d3r
Copy link

Hello to both of you!

I happen to have the same (or similar) error.
When trying to "parse" a template in YAML, it fails for me in:
https://github.com/awslabs/aws-cfn-template-flip/blob/master/cfn_flip/__init__.py#L27
raising:

JSONDecodeError
Expecting value: line 1 column 1 (char 0)

When either a str or bytes is passed as the parameter and including a tab character, in any of its forms \t or <tab character> (being the second one just a tab in the IDE.

I tried to "clean" tabs (can do in its first form) when in a str before calling the function and it works, but no clue on the second type of tab.

Is it the same error? Any clue?

Thank you both in advance!

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