summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG4
-rw-r--r--lib/puppet/type.rb16
-rwxr-xr-xlib/puppet/type/group.rb8
-rw-r--r--lib/puppet/type/zone.rb6
-rwxr-xr-xspec/unit/type.rb1
5 files changed, 19 insertions, 16 deletions
diff --git a/CHANGELOG b/CHANGELOG
index b1d67a00f..bc0bcbc7e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,8 @@
0.24.x
+ 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.
+
Modified the behaviour of resource-level 'retrieve' -- it only
calls 'retrieve' on each property if the resource exists.
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
diff --git a/spec/unit/type.rb b/spec/unit/type.rb
index a1a9e6b23..5e6cf3357 100755
--- a/spec/unit/type.rb
+++ b/spec/unit/type.rb
@@ -35,6 +35,7 @@ describe Puppet::Type do
end
end
+
describe "when in a catalog" do
before do
@catalog = Puppet::Node::Catalog.new