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 Signed-off-by: Stefan Schulte <[email protected]> --- lib/puppet/type.rb | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) 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? -- 1.7.3.4 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
