【问题标题】:puppet "Error 400 on SERVER : Could not find class"木偶“服务器上的错误 400:找不到类”
【发布时间】:2015-04-09 07:56:35
【问题描述】:

这个问题的帖子和解决方案太多了,但我仍然无法解决它。 我正在使用 puppet 3.7.5

以下是详细内容

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'

模块路径

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}",
         }        
}

代理

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

【问题讨论】:

  • 请注意,在 Puppet 3.7 及以上版本中,您根本不应该使用 import。请改用manifest=/etc/puppet/manifests 的设置(puppet.conf)。在此过程中,请参阅有关将所有内容迁移到目录环境的信息。

标签: puppet


【解决方案1】:

mytest 只能在模块mytest 中找到。你不能只是把它扔到模块services 并期望 Puppet 能够从那里查找它。

【讨论】:

  • 谢谢,但是如果我在一个模块中有多个类怎么办。
  • @MudasarYasin 您可以命名类,例如site::mytest 将在 site 模块中搜索,在 site/manifests/mytest.ppsite/manifests/init.pp 中。
  • 谢谢......我得到了我自己问题的答案......谢谢你总是帮助我......我用名称服务定义了另一个类:: myfile 并在其节点文件中调用。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-11-03
  • 2020-07-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多