diff options
author | Dan Bode <dan@puppetlabs.com> | 2012-10-02 18:53:53 -0700 |
---|---|---|
committer | Dan Bode <dan@puppetlabs.com> | 2012-10-02 18:53:53 -0700 |
commit | cbc90d38347f8ca61de2208b16ffc76f9fd5938c (patch) | |
tree | e000b4755f7157439d48aaeab0fe081685ae0e59 /lib/puppet/provider | |
parent | 1564c473a93105399bd777e78090463156948f2e (diff) | |
download | puppet-inifile-cbc90d38347f8ca61de2208b16ffc76f9fd5938c.tar.gz puppet-inifile-cbc90d38347f8ca61de2208b16ffc76f9fd5938c.tar.bz2 |
Make value a property
This commit converts value to a property so that it
can be managed and modified when a file already has
a value set.
It was previously treating the line creation state
the same as the update case, which is not in
alignment with Puppet's model.
Diffstat (limited to 'lib/puppet/provider')
-rw-r--r-- | lib/puppet/provider/ini_setting/ruby.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/puppet/provider/ini_setting/ruby.rb b/lib/puppet/provider/ini_setting/ruby.rb index aca8ba2..946685e 100644 --- a/lib/puppet/provider/ini_setting/ruby.rb +++ b/lib/puppet/provider/ini_setting/ruby.rb @@ -1,8 +1,9 @@ require File.expand_path('../../../util/ini_file', __FILE__) Puppet::Type.type(:ini_setting).provide(:ruby) do + def exists? - ini_file.get_value(resource[:section], resource[:setting]) == resource[:value].to_s + ini_file.get_value(section, setting) end def create @@ -11,6 +12,15 @@ Puppet::Type.type(:ini_setting).provide(:ruby) do @ini_file = nil end + def value + ini_file.get_value(section, setting) + end + + def value=(value) + ini_file.set_value(section, setting, resource[:value]) + ini_file.save + end + def section resource[:section] end |