The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:

Bug #5661

Creating type instances is broken when type uses composite keys

Added by Stefan Schulte over 5 years ago. Updated about 5 years ago.

Status:ClosedStart date:12/23/2010
Priority:NormalDue date:
Assignee:Stefan Schulte% 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:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com


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

Related to Puppet - Bug #10109: Composite keys cause Invalid parameter false error Closed 10/15/2011
Blocks Puppet - Feature #5660: Puppet should handle port entries in /etc/services with a... Tests Insufficient 12/23/2010

History

#1 Updated by Stefan Schulte over 5 years ago

  • Affected Puppet version set to 2.6.0

#2 Updated by Stefan Schulte over 5 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 5 years ago

  • Status changed from Unreviewed to In Topic Branch Pending Review
  • Target version set to 2.7.x

#4 Updated by Jesse Wolfe about 5 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 5 years ago

  • Status changed from Merged - Pending Release to Closed
  • Target version changed from 2.6.x to 2.6.7

Also available in: Atom PDF