【发布时间】:2019-11-26 10:47:43
【问题描述】:
我正在对此进行测试并在 Puppet 代理节点上遇到错误
[root@pagent1 ~]# puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Could not find class ::nginx for pagent1.testcentos7.com (file: /etc/puppetlabs/code/environments/production/manifests/site.pp, line: 3, column: 3) on node pagent1.testcentos7.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
来自 Puppet 服务器的这些类的内容:
[root@pmaster ~]# cat /etc/puppetlabs/code/environments/production/manifests/site.pp
node pagent1.testcentos7.com {
class { 'nginx': }
}
[root@pmaster ~]# cat /etc/puppetlabs/code/environments/production/modules/nginx/manifests/manifests/init.pp
class nginx {
contain nginx::install
}
[root@pmaster ~]# cat /etc/puppetlabs/code/environments/production/modules/nginx/manifests/install.pp
class nginx::install {
package { 'install_nginx':
name => 'nginx',
ensure => 'present',
}
}
语法检查显示此错误:
[root@pmaster ~]# puppet parser validate /etc/puppetlabs/code/environments/production/modules/nginx/manifests/manifests/init.pp
Error: Could not parse for environment production: Unacceptable location. The name 'nginx' is unacceptable in file '/etc/puppetlabs/code/environments/production/modules/nginx/manifests/manifests/init.pp' (file: /etc/puppetlabs/code/environments/production/modules/nginx/manifests/manifests/init.pp, line: 7, column: 1)
注意:使用 Puppet Development Kit (PDK) 创建模块“nginx”及其类。
这是一个错误还是什么,或者我的类名有误?
我找到的相关主题是https://groups.google.com/forum/embed/#!topic/puppet-users/nxbwCvWrgMI,但希望有人帮我简化一下
【问题讨论】:
-
类的命名和排列似乎是正确的。在这种情况下,最可能的问题是访问控制问题。 puppetserver 通常不作为特权进程运行,因此它依赖于所有清单和数据的所有权和权限(以及 SELinux 上下文,...)来允许它访问。如果他们不这样做,那么就好像他们的内容不存在一样。
-
谢谢。禁用 SELinux 和防火墙,仍然出现此错误。在此处的单独答案中找到了修复并提交了解决方案:)
标签: puppet