I am using yq tool to write data to a yaml file, but i am unable to write the data persistently to the yaml file. when executed the below command it returns the output i have expected to the console but it is writing only first section to the file... any help is greatly appreciated.
yq version: 3.4.1
Command:
yq n affinity-controller.fresh_install "False" > history.yaml
yq w -d'*' history.yaml snapshot-validation-webhook.fresh_install "False"
contents of history.yaml after executing the above command
affinity-controller:
fresh_install: False
expected output:
affinity-controller:
fresh_install: False
snapshot-validation-webhook:
fresh_install: False
For yq v3, according to doc, you should do it like this:
yq w -i history.yaml snapshot-validation-webhook.fresh_install "False"
For yq v4 (please note the leading dot):
yq e '.snapshot-validation-webhook.fresh_install=False' -i history.yaml
Tested and verified on localhost.
Snap users: Please note that there's a bug in yq:4.30.7 https://github.com/mikefarah/yq/issues/1521
Symptom: You'll get the following error when running yq: Error: chown/tmp/temp1636774104: operation not permitted
Downgrade yq to last working version (4.30.3): sudo snap refresh yq --channel=v4/stable
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.