[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

Luke Kanies luke at madstop.com
Fri Jan 23 14:21:07 UTC 2009


The following commit has been merged in the master branch:
commit 7da41528e82e5b4d36d4ac33689db0fa92480b3f
Author: Luke Kanies <luke at madstop.com>
Date:   Tue Sep 30 22:34:05 2008 -0500

    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 at madstop.com>

diff --git a/CHANGELOG b/CHANGELOG
index b1d67a0..bc0bcbc 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 1989fc0..e377a35 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 2a5ac30..cb11a60 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 4fd9267..7601ec4 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 a1a9e6b..5e6cf33 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

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list