Skip to content

stdlib::to_toml behaves differently on dotted keys compared to TOML::Generator #1452

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

Open
jay7x opened this issue Apr 26, 2025 · 1 comment

Comments

@jay7x
Copy link

jay7x commented Apr 26, 2025

Describe the Bug

TOML supports "dotted keys", that is about the same as our "dotted notation" when accessing facts.
Our stdlib::to_toml() uses toml-rb code, that has the issue when dealing with dotted keys.

I hit this when following the puppet-grafana's LDAP config example. It uses toml gem at the moment. When replaced with stdlib::to_toml() it produces a broken TOML.

As I see from unit tests, to_toml() expects a proper Puppet DSL Hash, while toml gem can work with dotted keys.

As a consequence, it's impossible to just replace TOML::Generator with our to_toml() function, because example syntax uses dotted key instead of a nested Hash or Array.

Another problem is sections reordering. E.g. [servers.attributes] section goes before [[servers]], which is wrong.

Expected Behavior

  1. It'd be nice if dotted keys wouldn't be quoted.
  2. It'd be nice if sections wouldn't be reordered.
@jay7x jay7x changed the title stdlib::to_toml is misbehaving on dotted keys stdlib::to_toml behaves differently on dotted keys compared to TOML::Generator Apr 26, 2025
@jay7x
Copy link
Author

jay7x commented Apr 26, 2025

See voxpupuli/puppet-grafana#333 for a bit more context and details.

TBH, I'm not sure if this is a bug or "feature"..

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

1 participant