Ask Your Question

Class not found ( or not autoloading)

asked 2013-05-16 20:50:45 -0600

fruitbox gravatar image

updated 2013-05-18 00:52:21 -0600

Hi folks,

I've a site.pp (puppet v3.1.1) with :

import "nodes/*.node"

import "classes/*.class".

In one of my classes /etc/puppet/manifests/classes/rhel6.class (ref: below) , If I remove the (legacy) import statements, I get errors of the following form:

"Error 400 on SERVER: Could not find class xxxx"

I would have thought the import statements as been redundant as class1-3 exist as proper modules , in the proper module-path. I've checked the permissions,module structure,init.pp,class/module name spelling..confirming everything as valid modules.

Why isn't the autoloader loading the modules ... (more)

edit retag flag offensive close merge delete


Funny that, but it seems to import *.node files just fine. And if I put the import statements for the classes ( as shown in the rhel6.class) , it works just ...(more)

fruitbox gravatar imagefruitbox ( 2013-05-20 20:08:45 -0600 )edit

For science, you could try `include classes/class1` granted your current structure that should make the classes you wrote visible... You didn't have the problems with nodes as they ...(more)

Julien R. gravatar imageJulien R. ( 2013-05-21 00:27:01 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2013-05-16 21:01:27 -0600

Puppet looks up for .pp files, not .class, see a complete example

Ideally, forget about import statement, if you organize your code properly (in modules, etc) you should not need any, just include statements.

edit flag offensive delete link more

answered 2013-05-21 21:36:42 -0600

fruitbox gravatar image

Doh...Found the problem, my classes/modules had the uppercases in them eg : "rhel6-Puppetmaster_server". Having hypens probably doesn't help either :-) Apologies for NOT pasting the exact offending class.

Thanks for your help though !

Bit of digging around , reveals the following from puppetlabs language guide.

"Class names, module names, and the names of defined and custom resource types should be restricted to lowercase alphanumeric characters and underscores, and should begin with a lowercase letter; that is, they should match the expression [a-z][a-z0-9_]. Although some names that violate these restrictions currently work, using them is not recommended."*

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-05-16 20:50:45 -0600

Seen: 1,138 times

Last updated: May 21 '13