-
-
Notifications
You must be signed in to change notification settings - Fork 602
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
yq -d removes '---' header #351
Comments
it's not only on
becomes
and causes
|
I had a look at the issue and it looks like this behavior comes from the Strangely enough, the information about document separator is decoded and kept in the AST during parsing and later available to the encoder (in The only thing I can think of is to rewrite an encoder supporting document separators or maybe submit a feature request to the official yaml library so that the encoder gets configurable. |
It also happens when running |
this is indeed some strange behavior. My original document is: created: '2020-06-19T09:29:52.800086'
daemon_id: ubuntu
daemon_type: crash
hostname: ubuntu
last_refresh: '2020-06-19T09:33:50.400609'
started: '2020-06-19T09:29:53.002004'
status: 1
status_desc: running
version: 16.0.0-901-g713ef3c
---
container_image_name: foobar
created: '2020-06-19T09:33:32.265147'
daemon_id: ubuntu
daemon_type: mon
hostname: ubuntu
last_refresh: '2020-06-19T09:33:50.400690'
status: -1
status_desc: unknown running container_id: e8cdc5d68c36
container_image_id: 74803e884bea289d2d2d3ebdf6d37cd560499e955595695b1390a89800f4e37a
container_image_name: foobar
created: '2020-06-19T09:29:52.800086'
daemon_id: ubuntu
daemon_type: crash
hostname: ubuntu
last_refresh: '2020-06-19T09:33:50.400609'
started: '2020-06-19T09:29:53.002004'
status: 1
status_desc: running
version: 16.0.0-901-g713ef3c
container_image_name: foorbar
created: '2020-06-19T09:33:32.265147'
daemon_id: ubuntu
daemon_type: mon
hostname: ubuntu
last_refresh: '2020-06-19T09:33:50.400690'
status: -1
status_desc: unknown which makes |
+1 I faced this issue too. I've got some Ansible var yaml files which get wrote by yq. It always wipes out the '---' header. |
This is fixed in v4 of yq |
sorry for bothering you, but i think this has not be fixed in V4.
input aaa.yml
command:
result
|
I can report the same for version 4.3.1: it seems not to be fixed. |
I have the same issue on ver 3 and 4. |
I can reproduce this as well with an assign operation: $ cat test.yaml
---
a: 123
b:
c: 456
$ yq e '.b.c = 789' test.yaml
a: 123
b:
c: 789 |
This issue is still occurring with 4.9.1 |
It is too - sorry |
I've raised an issue against the underlying yaml library: go-yaml/yaml#749 |
Ok now its fixed (4.11.0) |
Sorry, on closer examination, @Diaoul's example works - not the comment above the doc like in jackyzy823's example |
Ok I think I've covered all scenarios in the 4.11.1 release @jackyzy823 |
I could successfully test @jackyzy823's example as well. |
yay! |
Hi @mikefarah , i tested with yq 1.11.2, seems that it doesn't work like excepted, ubuntu$ yq -V
yq (https://github.com/mikefarah/yq/) version 4.11.2
ubuntu$ cat <<EOF | yq e '.password = "random password"' -
> #@data/values
> #@overlay/match-child-defaults missing_ok=True
>
> ---
> #! The namespace to install Harbor
> namespace: harbor
> hostname: example.com
> password:
> EOF
#@data/values
#@overlay/match-child-defaults missing_ok=True
#! The namespace to install Harbor
namespace: harbor
hostname: example.com
password: random password
ubuntu$ |
If a file contain a
---
header andyq -d
is issued, then the header gets removed.The text was updated successfully, but these errors were encountered: