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

10,779

Class mytest can and will only be found in module mytest. You cannot just throw it into module services and expect Puppet to be able to look it up from there.

Share:
10,779
Mudasar Yasin
Author by

Mudasar Yasin

Updated on June 13, 2022

Comments

  • Mudasar Yasin
    Mudasar Yasin almost 2 years

    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