Ask Your Question
1

Could not find class , but explicit import in site.pp works

asked 2014-09-04 00:36:33 -0500

Ath gravatar image

Hi,

I am facing an issue where puppet client can not find a module create in /etc/puppet/modules

**puppet config print modulepath**
/etc/puppet/modules:/usr/share/puppet/modules

I have a Puppet set up where I have created a module in

/etc/puppet/modules/users/manifests/

cat /etc/puppet/modules/users/manifests/init.pp
class moduleuser {
        user { 'maddy':
                 ensure => present,
                 uid => '508',
                 gid => 'root',
                 shell => '/bin/ksh',
        }
}

From the client(which is a separate UBUNTU machine), I run

puppet agent --no-daemonize --onetime --verbose

and I get an error, Info: Retrieving plugin Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class moduleusers for test.home on node test.home

However, if I import init.pp into site.pp file in the puppet master everything works fine.

cat /etc/puppet/manifests/site.pp
import 'emacs.pp'
import 'users.pp'
import 'irexample.pp'
import 'removepackage.pp'
import 'removedir.pp'
import '/etc/puppet/modules/users/manifests/init.pp'

node default {
}

node "test" {
                include moduleuser

}

Is this behavior Normal ?

Regards,

Athreya

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-09-04 07:43:58 -0500

llowder gravatar image

Yes, this is normal.

You don't have the module setup in such a way that the autoloader can find it.

You have the class named moduleuser but on the filesystem the module is named users, and those need to match - both will need to be either users or moduleuser.

Please refer to the module cheat sheet and the (classic) Learning Puppet section on module structure for more information.

edit flag offensive delete link more

Comments

Thanks, I tested it and it works perfectly fine. Thanks again for your time and answer

Ath gravatar imageAth ( 2014-09-04 13:22:32 -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

Stats

Asked: 2014-09-04 00:34:28 -0500

Seen: 1,092 times

Last updated: Sep 04 '14