[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

Sub-Tasks:
Key
Summary
Type
Status
Assignee
MODULES-2158 Add README documentation for create_i... Sub-task Resolved  
Template:

 Description   

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.



 Comments   
Comment by Peter Meier [ 2014/10/04 ]

Pull Request:

https://github.com/puppetlabs/puppetlabs-inifile/pull/129

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

Merged. This looks great!

Generated at Sat Dec 14 19:27:47 PST 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.