[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

Jesse Wolfe jes5199 at gmail.com
Wed Jul 14 10:35:10 UTC 2010


The following commit has been merged in the upstream branch:
commit 4bf695083839b61dc7107d8018e26ae991a52081
Author: Jesse Wolfe <jes5199 at gmail.com>
Date:   Thu Jun 24 15:27:14 2010 -0700

    [#3139] Make newattr idempotent
    
    audit's munge was not idempotent because newattr was not idempotent.
    This patch simplifies newattr such that it becomes idempotent.

diff --git a/lib/puppet/parameter.rb b/lib/puppet/parameter.rb
index 5642a75..abcd67d 100644
--- a/lib/puppet/parameter.rb
+++ b/lib/puppet/parameter.rb
@@ -283,7 +283,7 @@ class Puppet::Parameter
     end
 
     def value
-        unmunge(@value)
+        unmunge(@value) if @value
     end
 
     # Store the value provided.  All of the checking should possibly be
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index 17d6b2a..f6b0282 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -432,12 +432,8 @@ class Type
             raise Puppet::Error.new("Got nil value for %s" % name)
         end
 
-        if obj = @parameters[name]
-            obj.value = value
-            return nil
-        else
-            self.newattr(name, :value => value)
-        end
+        property = self.newattr(name)
+        property.value = value
 
         nil
     end
@@ -486,7 +482,7 @@ class Type
     # Create the actual attribute instance.  Requires either the attribute
     # name or class as the first argument, then an optional hash of
     # attributes to set during initialization.
-    def newattr(name, options = {})
+    def newattr(name)
         if name.is_a?(Class)
             klass = name
             name = klass.name
@@ -497,8 +493,7 @@ class Type
         end
 
         if @parameters.include?(name)
-            raise Puppet::Error, "Parameter '%s' is already defined in %s" %
-                [name, self.ref]
+            return @parameters[name]
         end
 
         if provider and ! provider.class.supports_parameter?(klass)
@@ -507,12 +502,9 @@ class Type
             return nil
         end
 
-        # Add resource information at creation time, so it's available
-        # during validation.
-        options[:resource] = self
         begin
             # make sure the parameter doesn't have any errors
-            return @parameters[name] = klass.new(options)
+            return @parameters[name] = klass.new(:resource => self)
         rescue => detail
             error = Puppet::Error.new("Parameter %s failed: %s" %
                 [name, detail])

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list