No description
Find a file
Chris Price f0d443fed0 Refactor to clarify implementation of save
The `save` method was previously relying on some really
specific implementation details of the `section` class
(when the start/end_line would be nil, etc.).  This made
the code a bit hard to follow.

This commit introduces a few utility methods in the
`section` class (`is_new_section?`, `is_global?`), and
refactors the `save` method to use them... this makes
the logic a little easier to follow and should hopefully
make it easier to maintain.
2012-10-20 23:14:39 -07:00
lib/puppet Refactor to clarify implementation of save 2012-10-20 23:14:39 -07:00
spec Better handling of whitespace lines at ends of sections 2012-10-20 01:43:19 -07:00
tests Add example for ensure=absent 2012-10-20 22:16:36 -07:00
CHANGELOG Updated CHANGELOG and Modulefile; final commit for 0.0.3 release 2012-09-24 10:20:45 -07:00
Modulefile Updated CHANGELOG and Modulefile; final commit for 0.0.3 release 2012-09-24 10:20:45 -07:00
README.markdown Add CHANGELOG and update README; final commit for 0.0.2 release 2012-08-20 14:13:37 -07:00

INI-file module

This module provides resource types for use in managing INI-style configuration files. The main resource type is ini_setting, which is used to manage an individual setting in an INI file. Here's an example usage:

ini_setting { "sample setting":
  path    => '/tmp/foo.ini',
  section => 'foo',
  setting => 'foosetting',
  value   => 'FOO!',
  ensure  => present,
}

A few noteworthy features:

  • The module tries hard not to manipulate your file any more than it needs to. In most cases, it should leave the original whitespace, comments, ordering, etc. perfectly intact.
  • Supports comments starting with either '#' or ';'.
  • Will add missing sections if they don't exist.
  • Supports a "global" section (settings that go at the beginning of the file, before any named sections) by specifying a section name of "".