Bug #15741

Ambiguous error message when setting up an invalid requirement in the ruby dsl

Added by Joe McDonagh 11 months ago. Updated 8 months ago.

Status:InvestigatingStart date:07/31/2012
Priority:NormalDue date:
Assignee:Deepak Giridharagopal% Done:

0%

Category:error reporting
Target version:-
Affected Puppet version:2.7.9 Branch:
Keywords:errors rubydsl

Description

Say I were to have a regular puppet class called mysql::backup, and in this class i ‘include’ a ruby DSL class called mysql::backup::grants near the top of the file… now a few lines after the include statement, i have a resource defined we’ll call foo… if i require foo inside the ruby dsl class, I get this really ambiguous error message:

@@@ text Jul 31 10:40:06 puppet puppet-master[4656]: Anonymous modules have no name to be referenced by at /etc/puppet/production/grumps-modules/mysql/manifests/backup.pp:45 on node puppet @@@

Basically I just mucked around til I discovered that if I put the include AFTER the resource that I require inside the subclass, it works.


Related issues

Related to Puppet - Feature #16937: Improved Ruby DSL Closed 10/11/2012
Related to Puppet - Bug #17017: Improve puppet's error handling and exit code correctness. Accepted

History

#1 Updated by Joe McDonagh 11 months ago

Hm, scratch that, the requirement still causes it to fail… thought I had it! Either way, still a valid bug report. This error tells me nothing…

#2 Updated by Joe McDonagh 11 months ago

ok so, after hacking on this code i realized a couple things:

  1. The problem resource (being created with create_resource), I was erroneously exporting. I removed the export do end part.
  2. Changed the parse order of the include as mentioned in the first post so that the subclass was included after the resource it required was.
  3. the require itself, i had done it in the style of actual puppet code, ie:

:require => Database_user[“whatever@127.0.0.1”]

First problem is I needed to put single quotes around it. However, I also discovered that having double quotes around the name confused Puppet and made it unable to locate the resource… presumably it is doing a simple string comparison without stripping first and last quotes.

#3 Updated by eric sorenson 10 months ago

  • Status changed from Unreviewed to Investigating
  • Assignee set to Deepak Giridharagopal

#4 Updated by eric sorenson 8 months ago

  • Parent task set to #17017

#5 Updated by eric sorenson 8 months ago

  • Parent task deleted (#17017)

Also available in: Atom PDF