[MODULES-1399] create_ini_settings function Created: 2014/10/04  Updated: 2015/05/27  Resolved: 2015/05/27

Status: Resolved
Project: Modules
Component/s: inifile
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Normal
Reporter: Peter Meier Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

MODULES-2158 Add README documentation for create_i... Sub-task Resolved  


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'

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.

Comment by Peter Meier [ 2014/10/04 ]

Pull Request:


Comment by Hunter (Hunner) Haugen [ 2015/05/27 ]

Merged. This looks great!

Generated at Sat Aug 08 17:53:03 PDT 2020 using Jira 8.5.2#805002-sha1:a66f9354b9e12ac788984e5d84669c903a370049.