The previous match for \s would also match on newlines. This caused
existing settings with blank values to have the newline considered part
of the whitespace surrounding the separator. When such settings are
set with a value, the value ends up on the next line.
Also adding acceptance test for this particular situation.
Our documentation says to use "" for section if you want top of file
global settings, this defaults to that assumption if the user doesn't
provide a section parameter at all.
1. Remove any "what this affects" sections, except where particularly warranted.
2. Make sure that for each parameter, where applicable, there is a data type and a default value.
3. Make sure that for each parameter that's applicable, there is a note if the parameter is optional.
4. Make sure the links in the README work and are accurate.
5. Update the link in the Contributing section to point here: https://docs.puppetlabs.com/forge/contributing.html
6. General copyediting.
create_ini_settings is a function that allows you to create
ini_setting resources from a simple hash:
$settings = { section1 => {
setting1 => val1
},
section2 => {
setting2 => val2,
setting3 => {
ensure => absent
}
}
}
$defaults = {
path => '/tmp/foo.ini'
}
create_ini_settings($settings,$defaults)
Will create the following resources
ini_setting{'[section1] setting1':
ensure => present,
section => 'section1',
setting => 'setting1',
value => 'val1',
path => '/tmp/foo.ini',
}
ini_setting{'[section2] setting2':
ensure => present,
section => 'section2',
setting => 'setting2',
value => 'val2',
path => '/tmp/foo.ini',
}
ini_setting{'[section2] setting3':
ensure => absent,
section => 'section2',
setting => 'setting3',
path => '/tmp/foo.ini',
}
This allows one to create much easier classes
that should be able to manage an arbritary set of
ini-style settings without having to specify each
one of them.
Noticed this when I was testing the module out with a FreeBSD host this code duplicates the shared_example used in the rest of the spec, so I DRY'd it up! 👍
We have many ini-style configuration files which use : as key value
separator. We'd like to be able to manage them with ini_setting as well.
This here is a naïve first attempt in that direction.
Please note that despite the fact that this *should* match, it's failing
unit tests.. This is a work in progress.