Ask Your Question
0

puppet “Error 400 on SERVER : Could not find class”

asked 2015-04-09 04:10:20 -0500

mudasar gravatar image

There are TOO many post and solution for this problem, but still i am not able to solve it. I am using puppet 3.7.5

Following is details

root@p1:/etc/puppet/manifests# ls -l
total 8
-rw-r--r-- 1 root root 40 Apr  9 12:37 nodes.pp
-rw-r--r-- 1 root root 18 Apr  9 11:58 site.pp
root@p1:/etc/puppet/manifests# cat nodes.pp
node 'wa.ro.XXX' {
        include mytest
}
root@p1:/etc/puppet/manifests# cat site.pp
import 'nodes.pp'
Module path

root@p1:/etc/puppet/manifests# puppet master --configprint modulepath
/etc/puppet/modules:/usr/share/puppet/modules

root@p1:/etc/puppet# tree -L 2 -d modules
modules
- configfiles
  -- files
  -- manifests
- services
  -- files
  -- manifests

root@p1:/etc/puppet# cat modules/services/manifests/init.pp
class mytest {
       file { '/tmp/puppettestfgt56666' :
          mode    => 0644,
          content => "This Learning Puppet VM's IP address is ${ipaddress}",
         }        
}

On agent

root@wa:/var/cache# puppet agent --no-daemonize --onetime --verbose
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class mytest for wa.ro.XXX on node wa.ro.XXX
Notice: Using cached catalog
Info: Applying configuration version '1428561896'
Notice: Finished catalog run in 0.07 seconds
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
2

answered 2015-04-09 07:43:19 -0500

llowder gravatar image

You don't have the right module layout.

The autoloader is very particular about where it looks for classes.

You have the class mytest defined in a location where it is looking for services.

You need to either make a module named mytest and move modules/services/manifests/init.pp to modules/mytest/manifests/init.pp or rename the file to mytest.pp and the class to services::mytest.

You may wish to review the following docs as well:

edit flag offensive delete link more

Comments

Or rename class to services in your init.pp file which would match your current folder layout. class services {

Chris gravatar imageChris ( 2015-04-10 11:23:51 -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: 2015-04-09 04:10:20 -0500

Seen: 8,910 times

Last updated: Apr 09 '15