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

Quotes are being removed #169

Closed
IdanAdar opened this issue Aug 12, 2018 · 3 comments
Closed

Quotes are being removed #169

IdanAdar opened this issue Aug 12, 2018 · 3 comments
Labels

Comments

@IdanAdar
Copy link

IdanAdar commented Aug 12, 2018

Given this:

env:
            - name: "CLUSTER_NAME"
              value: "<YOUR_CLUSTER_NAME>"
            - name: "NRIA_LICENSE_KEY"
              value: "<YOUR_LICENSE_KEY>"
            - name: "NRIA_VERBOSE"
              value: "0"

How can I insert a new value but preserve the quotes?

yq w -d3 -i newrelic-infrastructure-k8s-latest.yaml spec.template.spec.containers[0].env[1].value 1234

The above command inserts it w/out quotes, but "1234" also doesn't.

The result is:

env:
        - name: CLUSTER_NAME
          value: <YOUR_CLUSTER_NAME>
        - name: NRIA_LICENSE_KEY
          value: 1234
        - name: NRIA_VERBOSE
          value: "0"
        - name: NRIA_DISPLAY_NAME
@mikefarah
Copy link
Owner

yep try passing in escaped quotes:

yq w -d3 -i newrelic-infrastructure-k8s-latest.yaml spec.template.spec.containers[0].env[1].value \"1234\"

@mikefarah
Copy link
Owner

Note that this only works for values that would otherwise not be a string (e.g. a number) and it doesn't work for values that the underlying library things that are strings :(

So it won't fix the docker port issue mentioned here: #19 (comment)

@mikefarah
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants