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

Better support of comments #76

Open
dr4Ke opened this issue Sep 25, 2019 · 5 comments
Open

Better support of comments #76

dr4Ke opened this issue Sep 25, 2019 · 5 comments

Comments

@dr4Ke
Copy link

dr4Ke commented Sep 25, 2019

Take this file.yml:

variables:
  var1: VAR1

#This is another definition
other:
  var2: VAR2

Use this task:

- name: add variable
  yedit:
    src: file.yml
    key: variables.var3
    value: VAR3

You end up with file.yml:

variables:
  var1: VAR1

#This is another definition
  var3: VAR3
other:
  var2: VAR2

It's correct in a functional point of view but ugly. It would be better to have:

variables:
  var1: VAR1
  var3: VAR3

#This is another definition
other:
  var2: VAR2
@dr4Ke
Copy link
Author

dr4Ke commented Sep 25, 2019

I suspect this is related to the ruamel.yaml module, not in this one.

@dr4Ke
Copy link
Author

dr4Ke commented Sep 26, 2019

@Xtigyro
Copy link

Xtigyro commented Apr 17, 2021

In my case it removes all the comments in the YAML file. @dr4Ke Has it happened to you?

@dr4Ke
Copy link
Author

dr4Ke commented Apr 22, 2021

I don't remember such a thing, but I have not used it in a while, so…

@amg-web
Copy link

amg-web commented Jul 7, 2022

@Xtigyro
same to me. it removed all comments and empty lines.

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

No branches or pull requests

3 participants