Commit graph

3 commits

Author SHA1 Message Date
David Danzilio
a94f51e68d Adding path to create_ini_settings resources
Currently the create_ini_settings function creates an ini_setting with a
title comprised of the section and setting names. This means that we
run into resource conflicts when defining the same section/setting
combinations but in different files. Since the path parameter is
required, we can safely add this to the title of the ini_setting
resource created by the create_ini_settings function. This commit does
just that.
2015-08-12 18:00:57 -04:00
duritong
9f03e8a3d1 remove dead code
found some dead code to remove
2015-03-23 22:29:22 +01:00
mh
6eb8f9ca98 introduce create_ini_settings
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.
2015-01-28 22:09:34 +01:00