Skip to content

Puppet::Util::Inifile: set_value does not honor the default key_val_separator #544

Open
@kajinamit

Description

@kajinamit

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:

  1. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions