Bug #4314

Dashes in definition names no longer allowed?

Added by Thorsten Biel almost 2 years ago. Updated over 1 year ago.

Status:Closed Start date:07/21/2010
Priority:Normal Due date:
Assignee:Markus Roberts % Done:

0%

Category:-
Target version:2.6.1
Affected Puppet version:2.6.0 Branch:git@github.com:MarkusQ/puppet.git ticket/master/4314
Keywords:
Votes: 2

Description

Following output from a client running Puppet 0.25.5, connecting to a master running 2.6.0:

 # puppetd --test
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate definition: Apache::Apache-webmon[default] is already defined in file /etc/puppet/modules/apache/manifests/setup_apache2_instance.pp at line 361; cannot redefine at /etc/puppet/modules/apache/manifests/setup_apache2_instance.pp:368 on node usateppndb01
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

The corresponding excerpt from the manifest:

   # set up monitoring using munin and webmon
   #
   # TODO: Munin can handle multiple Apaches per plugin, so this should
   # be re-worked to set up Munin once for all Apache instances on
   # a server
   #
   apache::apache-munin { "${apache2instancename}":
     apache2instancename => "${apache2instancename}",
     projectname => "${projectname}"
   }
   # webmon should be cleanly set up with separate configs and cron
   # jobs per instance - easier to clean up afterwards
   #
   apache::apache-webmon { "${apache2instancename}":
     apache2instancename => "${apache2instancename}",
     projectname => "${projectname}"
   }

When I change the definition names to remove the dash (i.e. apache::apache-munin becomes apache::munin, same with apache::apache-webmon) the error disappears.

The above definitions used to work on a 0.25.4 master. I can’t find any mention of syntax changes regarding definitions in the release notes, please advise.


Related issues

related to Puppet - Bug #4233: Catalogs fail to deserialize if resources contain a newli... Closed 07/14/2010
related to Puppet - Bug #4293: Define and use a define within a class Closed 07/19/2010

History

Updated by Thorsten Biel almost 2 years ago

Changing the ‘–’ in the definition name to a “_” (underscore) is also sufficient.

Updated by Markus Roberts almost 2 years ago

  • Status changed from Unreviewed to Accepted
  • Target version set to 2.6.1

James and Markus strike again. This was a bug introduced by a last minute fix.

Updated by R.I. Pienaar almost 2 years ago

Markus Roberts wrote:

James and Markus strike again. This was a bug introduced by a last minute fix.

It now behaves as documented though, from the language reference:

You can use the characters A-Z, a-z, 0-9 and underscores in variables, resources and class names. In Puppet releases prior to 0.24.6, you cannot start a class name with a number.

It was broken before, or the docs lied :P

Updated by Peter Meier almost 2 years ago

It was broken before, or the docs lied :P

uh, the docs lied!!! ;)

I have @–@ in various parts and I would be happy to not have to change that, although I think I only have it in module-names resp. class-names and this part doesn’t seem to be broken. So we have kinda a inconsistency here, which we should imho sort out.

Updated by Thorsten Biel almost 2 years ago

Well, if the docs were right, then this is a non-issue. :–)

Only thing left then would be to throw an error when characters other than [A-Za-z0-9_] show up in a resource name?

Updated by Jasper Poppe almost 2 years ago

I can confirm this, I vote for allowing ‘–’ in definitions (It worked before, so compatibility wise it would be nice) or at least send a clear error message.

A ‘–’ in the define name generates: cs-ops001b:/seedpimp# puppet get-puppet26.pp Duplicate definition: Get-puppet::Wget[wget-puppetcommon] is already defined in file /seedpimp/get-puppet26.pp at line 23; cannot redefine at /seedpimp/get-puppet26.pp:23 on node cs-ops001b.intern.marktplaats.nl cs-ops001b:/seedpimp#

With older versions it works fine.

Updated by Peter Meier almost 2 years ago

Jasper Poppe wrote:

I can confirm this, I vote for allowing ‘–’ in definitions (It worked before, so compatibility wise it would be nice) or at least send a clear error message.

A ‘–’ in the define name generates: cs-ops001b:/seedpimp# puppet get-puppet26.pp Duplicate definition: Get-puppet::Wget[wget-puppetcommon] is already defined in file /seedpimp/get-puppet26.pp at line 23; cannot redefine at /seedpimp/get-puppet26.pp:23 on node cs-ops001b.intern.marktplaats.nl

This is imho more a problem of #4242, but looks like there have been another use case found for that bug. Can you update the ticket there with maybe an anonymised version, thanks.

Updated by Markus Roberts almost 2 years ago

  • Assignee set to Markus Roberts

Updated by Markus Roberts almost 2 years ago

  • Status changed from Accepted to Ready For Checkin
  • Branch set to git@github.com:MarkusQ/puppet.git ticket/0.25.x/4314

Added ‘–’ to the char set.

Updated by R.I. Pienaar almost 2 years ago

2974 is related

Updated by Markus Roberts almost 2 years ago

  • Branch changed from git@github.com:MarkusQ/puppet.git ticket/0.25.x/4314 to git@github.com:MarkusQ/puppet.git ticket/master/4314

Updated by Nick Lewis almost 2 years ago

  • Status changed from Ready For Checkin to Closed

Pushed in commit:9569136329f87eeb102e589a3d5e9c26d8632aad in 2.6.x

Updated by martin krafft over 1 year ago

I see this bug even with definitions not containing hyphens if the enclosing class contains a hyphen. My solution for now is to move the definition out of the class, which fixes it for all cases, including when the definition itself has a hyphen in the name! Hence, the problem is not the name of the definition, but the name of the namespace/class.

Updated by James Turnbull over 1 year ago

Martin – did you test this fix?

Updated by martin krafft over 1 year ago

Not yet. I am sorry, but I didn’t have the time to debug this. Instead, I had to cancel the 2.6 deployment for now and revert to 0.25.4 :(

Also available in: Atom PDF