puppetlabs-inifile
puppetlabs-inifile copied to clipboard
Puppet::Util::Inifile: set_value does not honor the default key_val_separator
Describe the Bug
In Puppet OpenStack project we use the Puppet::Util::IniFile
utility class to manipulate ini settings.
We recently discovered that its set_value
method uses nil
(which is translated to ''
) as the default separator unless separator is explicitly passed.
This is inconsistent with the other logic (eg loading options from config file) and is confusing.
Expected Behavior
The set_value method honors the key_value_separator unless separator is explicitly defined
Steps to Reproduce
Steps to reproduce the behavior:
- Run the following code snippet
config = Puppet::Util::IniFile.new('./test.conf')
config.set_value('foo', 'bar', 'baz')
Current implementation results in dumping
[foo]
barbaz
into the test.conf
file.
Environment
- Version: 6.1.1
- Platform: CentOS Stream 9
Additional Context
N/A