Bug #5661
Creating type instances is broken when type uses composite keys
| Status: | Closed | Start date: | 12/23/2010 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% | ||
| Category: | - | |||
| Target version: | 2.6.7 | |||
| Affected Puppet version: | 2.6.0 | Branch: | https://github.com/stschulte/puppet/tree/ticket/2.6.x/5661 | |
| Keywords: | ||||
Description
When you create a resourcetype with more than one namevar creating an instance of your type will lead to an error:
Instance creation:
ressource = @class.new(:title => 'telnet:tcp', :name => 'telnet', :protocol => :tcp, :number => '23')
Error:
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.
Related issues
History
#1
Updated by Stefan Schulte over 2 years ago
- Affected Puppet version set to 2.6.0
#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:
- https://github.com/stschulte/puppet/commit/35dd0702e9619706b6365a98da2826a612a4047a
This could be improved with some specs put it solved the issues I had while creating #5660
#3
Updated by James Turnbull over 2 years ago
- Status changed from Unreviewed to In Topic Branch Pending Review
- Target version set to 2.7.x
#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.
Available in 2.6.next as of commit:626aae793bae373d277c0ac07b07c3bacf462785
#5
Updated by James Turnbull about 2 years ago
- Status changed from Merged - Pending Release to Closed
- Target version changed from 2.6.x to 2.6.7