diff options
author | Luke Kanies <luke@madstop.com> | 2008-09-30 22:34:05 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-09-30 22:34:05 -0500 |
commit | 7da41528e82e5b4d36d4ac33689db0fa92480b3f (patch) | |
tree | 4e19e8e2477437fc4af74e8feda3fa24357b4b4a /lib/puppet | |
parent | ee579641f72b399e9e13e989a7779b533004b634 (diff) | |
download | puppet-7da41528e82e5b4d36d4ac33689db0fa92480b3f.tar.gz puppet-7da41528e82e5b4d36d4ac33689db0fa92480b3f.tar.xz puppet-7da41528e82e5b4d36d4ac33689db0fa92480b3f.zip |
Modified the group and zone resource types to no longer call
'currentpropvalues' as a means of setting all values to absent.
There should be no behaviour change from this change.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/type.rb | 16 | ||||
-rwxr-xr-x | lib/puppet/type/group.rb | 8 | ||||
-rw-r--r-- | lib/puppet/type/zone.rb | 6 |
3 files changed, 14 insertions, 16 deletions
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 1989fc057..e377a3547 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -901,17 +901,19 @@ class Type # retrieve the current value of all contained properties def retrieve - return currentpropvalues + return currentpropvalues end - # get a hash of the current properties. - def currentpropvalues(override_value = nil) - # it's important to use the 'properties' method here, as it follows the order - # in which they're defined in the object. It also guarantees that 'ensure' + # Get a hash of the current properties. Returns a hash with + # the actual property instance as the key and the current value + # as the, um, value. + def currentpropvalues + # It's important to use the 'properties' method here, as it follows the order + # in which they're defined in the class. It also guarantees that 'ensure' # is the first property, which is important for skipping 'retrieve' on # all the properties if the resource is absent. ensure_state = false - return properties().inject({}) { | prophash, property| + return properties().inject({}) do | prophash, property| if property.name == :ensure ensure_state = property.retrieve prophash[property] = ensure_state @@ -923,7 +925,7 @@ class Type end end prophash - } + end end # Are we running in noop mode? diff --git a/lib/puppet/type/group.rb b/lib/puppet/type/group.rb index 2a5ac30da..cb11a60a4 100755 --- a/lib/puppet/type/group.rb +++ b/lib/puppet/type/group.rb @@ -118,14 +118,6 @@ module Puppet defaultto false end - - def retrieve - if self.provider and @provider.exists? - return super - else - return currentpropvalues(:absent) - end - end end end diff --git a/lib/puppet/type/zone.rb b/lib/puppet/type/zone.rb index 4fd92672c..7601ec47b 100644 --- a/lib/puppet/type/zone.rb +++ b/lib/puppet/type/zone.rb @@ -377,7 +377,11 @@ end result = setstatus(hash) result else - return currentpropvalues(:absent) + # Return all properties as absent. + return properties().inject({}) do | prophash, property| + prophash[property] = :absent + prophash + end end end |