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

ytt fmt does not handle percentage signs #370

Closed
epk opened this issue Apr 26, 2021 · 3 comments
Closed

ytt fmt does not handle percentage signs #370

epk opened this issue Apr 26, 2021 · 3 comments
Assignees
Labels
bug This issue describes a defect or unexpected behavior carvel accepted This issue should be considered for future work and that the triage process has been completed good first issue An issue that will be a good candidate for a new contributor

Comments

@epk
Copy link

epk commented Apr 26, 2021

What steps did you take:

$ cat test.yaml               
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    name: jobs-low-2
    type: jobs
  name: jobs-low-2
spec:
  progressDeadlineSeconds: 900
  revisionHistoryLimit: 10
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 25%

$ cat test.yaml | ytt fmt -f -
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    name: jobs-low-2
    type: jobs
  name: jobs-low-2
spec:
  progressDeadlineSeconds: 900
  revisionHistoryLimit: 10
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 25%!(NOVERB)

What happened:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    name: jobs-low-2
    type: jobs
  name: jobs-low-2
spec:
  progressDeadlineSeconds: 900
  revisionHistoryLimit: 10
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 25%!(NOVERB) <- ???

What did you expect:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    name: jobs-low-2
    type: jobs
  name: jobs-low-2
spec:
  progressDeadlineSeconds: 900
  revisionHistoryLimit: 10
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 25%

Anything else you would like to add:

I think we are not properly escaping % in the parser

Environment:

  • ytt version (use ytt --version): ytt version 0.32.0

  • OS (e.g. from /etc/os-release): macOS 11.2.3 (20D91)


Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

@epk epk added bug This issue describes a defect or unexpected behavior carvel triage This issue has not yet been triaged for relevance labels Apr 26, 2021
@pivotaljohn
Copy link
Contributor

Thanks for reporting this bug, @epk.

To be clear, the %!(NOVERB) is output from fmt.Fprintf(). Which indicates that we're passing the raw string to that function without escaping the %, first, as @epk said.

Note that we're doing the proper handling in the template command:

$ ytt -f test.yml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    name: jobs-low-2
    type: jobs
  name: jobs-low-2
spec:
  progressDeadlineSeconds: 900
  revisionHistoryLimit: 10
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 25%

@pivotaljohn pivotaljohn added carvel accepted This issue should be considered for future work and that the triage process has been completed and removed carvel triage This issue has not yet been triaged for relevance labels Apr 27, 2021
@aaronshurley aaronshurley added the good first issue An issue that will be a good candidate for a new contributor label May 14, 2021
@aaronshurley
Copy link
Contributor

This feels like a reasonable good first issue to me. @pivotaljohn please correct this if I'm wrong.

We're going to move this to our Unprioritized Backlog at the moment but are open to PRs!

@vmunishwar vmunishwar self-assigned this Nov 15, 2021
@cari-lynn
Copy link
Contributor

Available in v0.38.0

@github-actions github-actions bot added the carvel triage This issue has not yet been triaged for relevance label Nov 19, 2021
@aaronshurley aaronshurley removed the carvel triage This issue has not yet been triaged for relevance label Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a defect or unexpected behavior carvel accepted This issue should be considered for future work and that the triage process has been completed good first issue An issue that will be a good candidate for a new contributor
Projects
None yet
Development

No branches or pull requests

5 participants