diff options
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 |