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

Action: Patch needs to support yaml containing string values. #111

Merged
merged 4 commits into from
Mar 7, 2019

Conversation

etsauer
Copy link
Contributor

@etsauer etsauer commented Mar 7, 2019

What does this PR do?

I ran into a scneario this week where our patch support fails to handle patch file that contain quotes strings, e.g.:

spec:
  tags:
    - name: "2.7"
      importPolicy:
        scheduled: true

This PR adds a test of this scenario, as well as a fix to the role to handle it better.

How should this be tested?

molecule test

Is there a relevant Issue open for this?

n/a

Who would you like to review this?

cc: @redhat-cop/openshift-applier

@etsauer etsauer changed the title WIP: Adding a test showing a patch thats failing, so we can fix it Action: Patch needs to support yaml containing string values. Mar 7, 2019
Copy link
Contributor

@oybed oybed left a comment

Choose a reason for hiding this comment

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

The more I think about this, I don't think I agree with the solution. i.e.: we're now processing it as yaml (and require the file to be written in yaml). This should just be a string of the content of the file. In other words, we are now making the openshift-applier be "smarter" about this content and it shouldn't be

@etsauer
Copy link
Contributor Author

etsauer commented Mar 7, 2019

@oybed I added a test showing that json still works as well. The only thing functionally that we are doing is a {yaml|json} to json conversion of the contents of the file, so that we don't have to deal with complex escaping of \n and \t characters in the string.

@etsauer
Copy link
Contributor Author

etsauer commented Mar 7, 2019

I should also mention that the current implementation of patch ONLY works for YAML. if you run the tests I added aginst the role in master, you'll see that even the simple tests we had will fail if you use a json formatted patch file.

Copy link
Contributor

@oybed oybed left a comment

Choose a reason for hiding this comment

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

LGTM

@oybed oybed merged commit 06d2629 into redhat-cop:master Mar 7, 2019
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