summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Price <chris@puppetlabs.com>2013-04-01 15:29:54 -0700
committerDan Bode <dan@puppetlabs.com>2013-04-02 15:10:43 -0700
commit6c245ef674316f4fbddb79698552138fe9f1e69a (patch)
treed231794a23687e28679afe8a934320476965c443 /lib
parente824ab2abae16e97f9a19d21580d6825c4bf705e (diff)
downloadpuppet-inifile-6c245ef674316f4fbddb79698552138fe9f1e69a.tar.gz
puppet-inifile-6c245ef674316f4fbddb79698552138fe9f1e69a.tar.bz2
Update Modulefile and Changelog, prepping for 0.10.0 release
This commit also adds some comments clarifying the new code that was added to support purging.
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/provider/ini_setting/ruby.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/puppet/provider/ini_setting/ruby.rb b/lib/puppet/provider/ini_setting/ruby.rb
index af7a073..e57ffe2 100644
--- a/lib/puppet/provider/ini_setting/ruby.rb
+++ b/lib/puppet/provider/ini_setting/ruby.rb
@@ -3,6 +3,15 @@ require File.expand_path('../../../util/ini_file', __FILE__)
Puppet::Type.type(:ini_setting).provide(:ruby) do
def self.instances
+ # this code is here to support purging and the query-all functionality of the
+ # 'puppet resource' command, on a per-file basis. Users
+ # can create a type for a specific config file with a provider that uses
+ # this as its parent and implements the method
+ # 'self.file_path', and that will provide the value for the path to the
+ # ini file (rather than needing to specify it on each ini setting
+ # declaration). This allows 'purging' to be used to clear out
+ # all settings from a particular ini file except those included in
+ # the catalog.
if self.respond_to?(:file_path)
# figure out what to do about the seperator
ini_file = Puppet::Util::IniFile.new(file_path, '=')
@@ -50,14 +59,22 @@ Puppet::Type.type(:ini_setting).provide(:ruby) do
end
def section
+ # this method is here so that it can be overridden by a child provider
resource[:section]
end
def setting
+ # this method is here so that it can be overridden by a child provider
resource[:setting]
end
def file_path
+ # this method is here to support purging and sub-classing.
+ # if a user creates a type and subclasses our provider and provides a
+ # 'file_path' method, then they don't have to specify the
+ # path as a parameter for every ini_setting declaration.
+ # This implementation allows us to support that while still
+ # falling back to the parameter value when necessary.
if self.class.respond_to?(:file_path)
self.class.file_path
else