puppetlabs / puppetlabs/puppetlabs-stdlib
stdlib::to_toml behaves differently on dotted keys compared to TOML::Generator
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 349
- Forks
- 573
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 1
Description
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
- It'd be nice if dotted keys wouldn't be quoted.
- It'd be nice if sections wouldn't be reordered.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the stdlib::to_toml implementation and its unit tests, then compare its output with TOML::Generator for dotted keys and sections. Reproduce the puppet-grafana LDAP example and verify that dotted keys are not quoted and that sections retain the required ordering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100