-
Notifications
You must be signed in to change notification settings - Fork 177
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
introduce create_ini_settings #129
Conversation
|
The tests do not fail locally... :-/ |
So far one would have had to add for each configuration setting to set a dedicated parameter and add an ini_setting. This change introduces a simple hash structure to set configuration values. This hash matches the influxdb toml file structure. Unfortunately puppet doesn't yet have an easy way (puppetlabs/puppetlabs-inifile#129) to do things like that. Which means that I had to trick around a little bit with puppet data structures. This can be removed once create_ini_settings got merged into the inifile module, until then this is a workaround, that makes the configuration much more flexible.
So far one would have had to add for each configuration setting to set a dedicated parameter and add an ini_setting. This change introduces a simple hash structure to set configuration values. This hash matches the influxdb toml file structure. Unfortunately puppet doesn't yet have an easy way (puppetlabs/puppetlabs-inifile#129) to do things like that. Which means that I had to trick around a little bit with puppet data structures. This can be removed once create_ini_settings got merged into the inifile module, until then this is a workaround, that makes the configuration much more flexible.
|
I would really like to see this getting merge. Would make things like jdowning/puppet-influxdb#20 wayyy easier.... |
bc863e4
to
2d14197
Compare
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.
2d14197
to
6eb8f9c
Compare
|
I did what was proposed by @cmurphy in duritong@4ab62d3#commitcomment-9479240 => remove the changes to .gitignore add forcing the files on the index , rebased the branch onto current master and also squeezed together the commits |
|
The more that I look at this, the more that I like it. I was going to suggest that the same thing can be done with And then use There is lots of redundancy with the resource titles and one has to either make multiple |
|
@wcooley this is exactly what it is for 😄 It should get merged! |
found some dead code to remove
|
Any news? |
|
Ping |
|
@duritong, I just stumbled over this neat little function while searching for a more elegant way to inject settings from Hiera. It saved me from a LOT of pain. Why is there no word about it in the README? |
|
So let's update the README then. Do you like to propose a PR? |
|
If you'd like me too - sure. Shall I open a ticket, too? (If yes: MODULES project? Or do puppetlabs modules have another tracker?) |
|
@duritong: Please take look at https://github.com/poikilotherm/puppetlabs-inifile/tree/fix/master/add_create_ini_settings_to_readme#function-create_ini_settings before I open a ticket and/or PR. Do you think this is a sufficient doc? |
|
Looks good to me, I guess more documentation is always welcomed. |
|
Right. Then I'll open a PR and a ticket... This will take some time to complete. :-/ Edit: see https://tickets.puppetlabs.com/browse/MODULES-2158 |
introduce create_ini_settings
create_ini_settings is a function that allows you to create
ini_setting resources from a simple hash:
Will create the following resources
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.