[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 2.6.5-303-gfcfa26a

Stefan Schulte stefan.schulte at taunusstein.net
Thu Mar 17 10:45:58 UTC 2011


The following commit has been merged in the upstream branch:
commit 35dd0702e9619706b6365a98da2826a612a4047a
Author: Stefan Schulte <stefan.schulte at taunusstein.net>
Date:   Sun Dec 5 11:30:42 2010 +0100

    (#5661) Creating types dont work with >1 namevar
    
    The methods [] and []= of type.rb are handling :name in a special way.
    When someone wants to access resource[:name] puppet tries to replace
    :name with the name_var. If the type has more than one key_attribute
    name_var is always returning false so we'll get the error
    
      Resource type <resourcetype> does not support parameter false
    
    This patch doesnt try to substitute :name if we dont have a single
    namevar, aka. we have more than one key_attribute

diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index 1b6e7dc..cb1022d 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -382,8 +382,8 @@ class Type
 
     fail("Invalid parameter #{name}(#{name.inspect})") unless self.class.validattr?(name)
 
-    if name == :name
-      name = name_var
+    if name == :name && nv = name_var
+      name = nv
     end
 
     if obj = @parameters[name]
@@ -403,8 +403,8 @@ class Type
 
     fail("Invalid parameter #{name}") unless self.class.validattr?(name)
 
-    if name == :name
-      name = name_var
+    if name == :name && nv = name_var
+      name = nv
     end
     raise Puppet::Error.new("Got nil value for #{name}") if value.nil?
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list