[英]Puppet Evaluation Error: Error while evaluating a Resource Statement, Could not find declared 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 服務器的這些類的內容:
[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”及其類。
這是一個錯誤還是什么,或者我在類名上犯了一個錯誤?。
我發現的相關主題是https://groups.google.com/forum/embed/#!topic/puppet-users/nxbwCvWrgMI但希望有人為我簡化這個
通過將“ init.pp ”移動到安裝類文件“ install.pp ”所在的路徑/etc/puppetlabs/code/environments/production/modules/nginx/manifests解決了這個問題。
為了更清楚,我將文件 ' init.pp ' 和 ' install.pp ' 放在同一位置目錄/etc/puppetlabs/code/environments/production/modules/nginx/manifests 中來解決這個問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.