Puppet错误:服务器上的错误500:服务器错误:评估错误:评估函数调用时出错,找不到类

Puppet错误:服务器上的错误500:服务器错误:评估错误:评估函数调用时出错,找不到类,puppet,Puppet,我正在测试这一点,并在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 5

我正在测试这一点,并在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开发工具包(PDK)创建模块“nginx”及其类

这是一个bug还是什么,或者我在类名上犯了一个错误


我找到的相关线程是,但希望有人为我简化这个问题

通过将“init.pp”移动到路径/etc/puppetlabs/code/environments/production/modules/nginx/manifests安装类文件“install.pp”中来解决这个问题


为了更清楚,我将文件“init.pp”和“install.pp”放在同一个位置目录/etc/puppetlabs/code/environments/production/modules/nginx/manifests来解决这个问题。

通过将“init.pp”移动到路径来解决这个问题/etc/puppetlabs/code/environments/production/modules/nginx/manifests其中存在安装类文件“install.pp


为了更清楚,我将文件“init.pp”和“install.pp”放在同一个位置目录/etc/puppetlabs/code/environments/production/modules/nginx/manifests中以解决这个问题。

类的命名和排列似乎是正确的。在这种情况下,最可能的问题是访问控制问题。puppetserver通常不作为特权进程运行,因此它依赖于所有清单和数据的所有权和权限(以及SELinux上下文和…)来允许其访问。如果他们没有,那就好像他们的内容不存在一样。谢谢。已禁用SELinux和防火墙,但仍显示此错误。在这里的一个单独的答案中找到了修复和提交的解决方案:)类的命名和排列似乎是正确的。在这种情况下,最可能的问题是访问控制问题。puppetserver通常不作为特权进程运行,因此它依赖于所有清单和数据的所有权和权限(以及SELinux上下文和…)来允许其访问。如果他们没有,那就好像他们的内容不存在一样。谢谢。已禁用SELinux和防火墙,但仍显示此错误。在这里找到了修复并提交了解决方案:)我猜是我的错。我不知道这两个清单在不同的目录中,尽管我现在在问题中看到了它。我很高兴你明白了。顺便说一句,在这里修改你的问题的标题以表示问题已经解决是违反惯例的。因此,我已回滚该编辑。如果你愿意,你可以通过点击旁边的复选标记来“接受”你的一个答案,包括你自己写的这一个。谢谢@JohnBollingerWell,我想是我的错。我不知道这两个清单在不同的目录中,尽管我现在在问题中看到了它。我很高兴你明白了。顺便说一句,在这里修改你的问题的标题以表示问题已经解决是违反惯例的。因此,我已回滚该编辑。如果你愿意,你可以通过点击旁边的复选标记来“接受”你的一个答案,包括你自己写的这个答案。谢谢@JohnBollinger