Puppet Error : Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Could not find class

Puppet Error : Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Could not find class

我正在对此进行测试,但在 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 服务器的 classes 的内容:

[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' 及其 classes。

这是一个错误还是什么,还是我用错了 class 名称?。

我发现的相关主题是 https://groups.google.com/forum/embed/#!topic/puppet-users/nxbwCvWrgMI,但希望有人为我简化它

通过将“init.pp”移动到路径 /etc/puppetlabs/code/environments/production/modules/nginx/manifests 中安装 class 文件 'install.pp' 存在。

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