Ask Your Question

puppet apply error: could not find class

asked 2013-06-14 15:03:03 -0500

BaltoStar gravatar image

I'm on Windows Server 2008 box "qa-server-1" with Puppet Agent for Windows

I've defined 2 modules and a node defs file :


class module-a{}


class module-b{}


node 'qa-server-1' { include 'module-a' include 'module-b' }

from Administrator Puppet Command Prompt I run :

puppet apply --verbose --modulepath=c:/puppetcode c:/puppetcode/nodes/qa-nodes.pp

Puppet finds & applies module-a but fails to find module-b :

Error: Could not find class module-b for qa-server-1 on node qa-server-1

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-06-14 17:49:41 -0500

mrzarquon gravatar image

You cannot nest modules into subfolders in a module path. You will want to move module-b to the same folder level as module-a.

(ie c:/puppetcode/modules/website-config/module-b/manifests/init.pp should c:/puppetcode/modules/module-b/manifests/init.pp).

More documentation around the file layout of a module is provided on the module docs page.

edit flag offensive delete link more


Seriously ? All modules must be in a flat folder structure under the module path root ? If true, that's disturbing because it doesn't allow good hierarchical organization.

BaltoStar gravatar imageBaltoStar ( 2013-06-14 18:46:48 -0500 )edit

I am now adopting Librarian-puppet, which transforms our GitHub deep hieararchy into a flat set of modules ( one couild even think of it as a form of de-normalization ).

BaltoStar gravatar imageBaltoStar ( 2013-06-14 20:56:35 -0500 )edit

You can always list multiple module dirs by using a colon separator. You can also use facts in your module path. For example /etc/puppet/$environment/modules. To your point ...(more)

Ancillas gravatar imageAncillas ( 2013-06-16 03:25:42 -0500 )edit

Check-out Librarian-puppet. It allows any arbitrary folder-hierarchy in source-control and converts it to a flat-structure on the master or agent machine.

BaltoStar gravatar imageBaltoStar ( 2013-06-16 12:58:11 -0500 )edit

answered 2013-06-14 19:05:51 -0500

GregLarkin gravatar image

You can structure your modules hierarchically, and here's an example that likens itself to the MVC (model-view-controller) pattern for web applications:

The pattern is SRC (service-role-capability), and we've implemented it here. Interestingly, the latest comment on the blog posting is from the original author who reports that he no longer uses this layout. :)

Here's a sample manifest for a master database server from our implementation (file modulesdir/capabilities/manifests/dbserver/master/init.pp):

class capabilities::dbserver::master::init {

  include capabilities::dbserver::master::install

  class {
    [ 'capabilities ...
edit flag offensive delete link more


Yeah I happened across that blog earlier today ... but when the only comment is the author deciding not to implement his own idea it's not inspiring :)

BaltoStar gravatar imageBaltoStar ( 2013-06-14 20:55:10 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2013-06-14 15:03:03 -0500

Seen: 8,195 times

Last updated: Jun 14 '13