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

ruamel.yaml loader and dumper: human readability / support for comments #2003

Closed
ghost opened this issue Jun 25, 2021 · 2 comments · Fixed by #2041
Closed

ruamel.yaml loader and dumper: human readability / support for comments #2003

ghost opened this issue Jun 25, 2021 · 2 comments · Fixed by #2041
Labels
bug Indicates an unexpected problem or unintended behavior
Milestone

Comments

@ghost
Copy link

ghost commented Jun 25, 2021

277f72d fixed the issue that comments where not preserved.
However when the runtime configuration is loaded with the default loader, as it was with the comment, and then dumped afterwards, the resulting file is formatted uglily:

{file-input: {bod_id: file-input, description: Reads file /assets/*.txt, group: Collectors,
name: File Input, enabled: true, module: intelmq.bots.collectors.file.collector_file,
run_mode: scheduled, parameters: {path: /assets, postfix: .txt, delete_file: false,...

Therefore I reverted the commit with 9a69461, which brings back a human readable and better structured format for the runtime.yaml. But OTOH it breaks comments again. We need a solution to preserve both, comments and readability.

@ghost ghost added the bug Indicates an unexpected problem or unintended behavior label Jun 25, 2021
@ghost ghost added this to the 3.0.1 milestone Jun 25, 2021
@ghost ghost changed the title ruamel.yaml loader and dumper: human readability ruamel.yaml loader and dumper: human readability / support for comments Jun 26, 2021
@ghost
Copy link
Author

ghost commented Jun 28, 2021

Maybe we use the dump-method wrongly?

ghost pushed a commit that referenced this issue Aug 16, 2021
This lets us be backwards compatible to JSON and still dump YAML in a
readable format.

Closes: #2003
@ghost ghost linked a pull request Aug 16, 2021 that will close this issue
@ghost ghost self-assigned this Aug 16, 2021
@ghost ghost closed this as completed in #2041 Aug 19, 2021
ghost pushed a commit that referenced this issue Aug 19, 2021
This lets us be backwards compatible to JSON and still dump YAML in a
readable format.

Closes: #2003
ghost pushed a commit that referenced this issue Aug 19, 2021
This lets us be backwards compatible to JSON and still dump YAML in a
readable format.

Closes: #2003
@sebix
Copy link
Member

sebix commented Aug 13, 2024

Comments are still not preserved, even though we use YAML(typ='unsafe', pure=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant