Creating type instances is broken when type uses composite keys
|Assignee:||Stefan Schulte||% Done:|
|Affected Puppet version:||2.6.0||Branch:||https://github.com/stschulte/puppet/tree/ticket/2.6.x/5661|
When you create a resourcetype with more than one namevar creating an instance of your type will lead to an error:
ressource = @class.new(:title => 'telnet:tcp', :name => 'telnet', :protocol => :tcp, :number => '23')
Resource type port does not support parameter false
with port beeing a resourcetype with name and protocal as a namevar. The reason is that puppet treats the parameter :name special. When puppet tries to set the name with
resource[:name] = value, it substitutes
:name with whatever the namevar is. Because
namevar returns false when we have more than one key_attribute, puppet tries to set a parameter “false” which does not exists.
#2 Updated by Stefan Schulte over 2 years ago
- Branch set to https://github.com/stschulte/puppet/tree/ticket/2.6.x/5661
My proposed patch:
This could be improved with some specs put it solved the issues I had while creating #5660
#4 Updated by Jesse Wolfe over 2 years ago
- Status changed from In Topic Branch Pending Review to Merged - Pending Release
- Target version changed from 2.7.x to 2.6.x
While I’d be happier if this code included a unit test, it’s obviously correct in a such a way that I’m merging it in.
and since this is an internal-correctness issue, I’m merging it to the 2.6 series.
2.6.next as of commit:626aae793bae373d277c0ac07b07c3bacf462785