Trouble with class with _ in name

72 views
Skip to first unread message

Matthew Kennedy

unread,
Dec 30, 2014, 12:35:01 PM12/30/14
to puppet...@googlegroups.com
I have code that pulls in profiles.

    if (defined("profile::${separator}::${profile}")) {
      include "profile::${separator}::${profile}"
    }

$separator will be something like 'app' or 'role'
$profile will be something like 'blah' or 'blah_app'

The profile classes looks like

class profile::app::blah (
) {
  notify { 'I am blah': }
}

or 

class profile::app::blah_app (
) {
  notify { 'I am blah_app': }
}


The problem is that if I have a profile with an underscore (blah_app) the profile is not found otherwise the code works as intended.  As far as I understand _ is a permissible for class names.

I'm using latest 3.7.3

Any help would be appreciated.

Matthew Kennedy

unread,
Dec 30, 2014, 2:59:34 PM12/30/14
to puppet...@googlegroups.com
Well, I did a downgrade to 3.7.2 and this issue no longer appears.  It appears there is a regression on 3.7.3.  I'll submit a bug.

Matthew Kennedy

unread,
Dec 30, 2014, 3:05:02 PM12/30/14
to puppet...@googlegroups.com


On Tuesday, December 30, 2014 10:35:01 AM UTC-7, Matthew Kennedy wrote:

Felix Frank

unread,
Jan 6, 2015, 6:49:04 PM1/6/15
to puppet...@googlegroups.com
On 12/30/2014 09:05 PM, Matthew Kennedy wrote:

    if (defined("profile::${separator}::${profile}")) {
      include "profile::${separator}::${profile}"
    }

Hi,

Is the if defined() construct significant? Can you only reproduce when it is in place? Why is it there and what does it do?

Note that, regardless of this issue, using this function can be hazardous.

Thanks,
Felix

Matthew Kennedy

unread,
Jan 7, 2015, 2:18:17 PM1/7/15
to puppet...@googlegroups.com
No, if you remove the defined() call and just include it will fail to find the class. Defined() is there simply to ensure that we can do the include.  For a bit more context I've written an abstraction layer that assigns apps/roles to nodes and will pull in profiles if they exist, that is where this snipit is from.  

So changing this to:

if ($profile == 'existantclass') {

  include "profile::${separator}::${profile}"
}

results in Error 400 on SERVER: Could not find class profile::app::existantclass for node1.vnet on node node1.vnet.

Me and defined() have had a rocky but ultimately agreeable relationship. 

Felix Frank

unread,
Jan 7, 2015, 2:28:09 PM1/7/15
to puppet...@googlegroups.com
On 01/07/2015 08:18 PM, Matthew Kennedy wrote:
So changing this to:

if ($profile == 'existantclass') {
  include "profile::${separator}::${profile}"
}

results in Error 400 on SERVER: Could not find class profile::app::existantclass for node1.vnet on node node1.vnet.

Wait, what, so the underscore is not relevant after all?

Matthew Kennedy

unread,
Jan 7, 2015, 2:29:37 PM1/7/15
to puppet...@googlegroups.com
Gosh sorry, would be something like existant_class.
Reply all
Reply to author
Forward
0 new messages