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

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

Open
kajinamit opened this issue Sep 20, 2024 · 0 comments · May be fixed by #545
Open

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

kajinamit opened this issue Sep 20, 2024 · 0 comments · May be fixed by #545

Comments

@kajinamit
Copy link
Contributor

kajinamit commented Sep 20, 2024

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

kajinamit added a commit to kajinamit/puppetlabs-inifile that referenced this issue Sep 20, 2024
... to use the consistent separator by default in all functions by
default. Users can still override the separator by passing
the separator argument when calling the function.

Fixes: puppetlabs#544
@kajinamit kajinamit linked a pull request Sep 20, 2024 that will close this issue
5 tasks
kajinamit added a commit to kajinamit/puppetlabs-inifile that referenced this issue Sep 20, 2024
... to use the consistent separator by default in all functions by
default. Users can still override the separator by passing
the separator argument when calling the function.

Fixes: puppetlabs#544
openstack-mirroring pushed a commit to openstack/puppet-swift that referenced this issue Sep 23, 2024
set_value method of Puppet::Util::IniFile uses '' for separator when
called without the separator argument[1]. Set the argument explicitly
to avoid broken rendering. Note that the argument was added in
puppetlabs-inifile 2.0.0 so we don't need to bump the min version.

[1] puppetlabs/puppetlabs-inifile#544

Closes-Bug: #2081303
Change-Id: I6112c6d12e860bd4b4030e5f784952a7358f617f
openstack-mirroring pushed a commit to openstack/openstack that referenced this issue Sep 23, 2024
* Update puppet-swift from branch 'master'
  to 93f15aa78c378dd853e000156ad14dfff15fa394
  - Define separator explicitly in set_value call
    
    set_value method of Puppet::Util::IniFile uses '' for separator when
    called without the separator argument[1]. Set the argument explicitly
    to avoid broken rendering. Note that the argument was added in
    puppetlabs-inifile 2.0.0 so we don't need to bump the min version.
    
    [1] puppetlabs/puppetlabs-inifile#544
    
    Closes-Bug: #2081303
    Change-Id: I6112c6d12e860bd4b4030e5f784952a7358f617f
openstack-mirroring pushed a commit to openstack/puppet-swift that referenced this issue Sep 24, 2024
set_value method of Puppet::Util::IniFile uses '' for separator when
called without the separator argument[1]. Set the argument explicitly
to avoid broken rendering. Note that the argument was added in
puppetlabs-inifile 2.0.0 so we don't need to bump the min version.

[1] puppetlabs/puppetlabs-inifile#544

Closes-Bug: #2081303
Change-Id: I6112c6d12e860bd4b4030e5f784952a7358f617f
(cherry picked from commit 93f15aa)
openstack-mirroring pushed a commit to openstack/puppet-swift that referenced this issue Sep 24, 2024
set_value method of Puppet::Util::IniFile uses '' for separator when
called without the separator argument[1]. Set the argument explicitly
to avoid broken rendering. Note that the argument was added in
puppetlabs-inifile 2.0.0 so we don't need to bump the min version.

[1] puppetlabs/puppetlabs-inifile#544

Closes-Bug: #2081303
Change-Id: I6112c6d12e860bd4b4030e5f784952a7358f617f
(cherry picked from commit 93f15aa)
(cherry picked from commit 5769e2a)
openstack-mirroring pushed a commit to openstack/puppet-swift that referenced this issue Sep 25, 2024
set_value method of Puppet::Util::IniFile uses '' for separator when
called without the separator argument[1]. Set the argument explicitly
to avoid broken rendering. Note that the argument was added in
puppetlabs-inifile 2.0.0 so we don't need to bump the min version.

[1] puppetlabs/puppetlabs-inifile#544

Closes-Bug: #2081303
Change-Id: I6112c6d12e860bd4b4030e5f784952a7358f617f
(cherry picked from commit 93f15aa)
(cherry picked from commit 5769e2a)
(cherry picked from commit a0dbaca)
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

Successfully merging a pull request may close this issue.

1 participant