我创建了一个名为'learn-tomcat'的模块,它有一个名为tomcat的类(在init.pp中)。当我尝试在节点定义中包含此类时,它不起作用,以下所有组合都会抛出错误,组合为:
include learn-tomcat::tomcat
include learn-tomcat
include tomcat
include ::tomcat
错误与上述组合相同:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class
现在我将模块目录learn-tomcat重命名为tomcat,然后开始工作!
include tomcat
include ::tomcat
include tomcat::tomcat
现在我对一些事情感到困惑:
答案 0 :(得分:3)
在这里,您可以全面解释命名空间和范围在puppet中的工作原理。
根据文章的例子:
name: file path:
apache <modulepath>/apache/manifests/init.pp
apache::mod <modulepath>/apache/manifests/mod.pp
apache::mod::passenger <modulepath>/apache/manifests/mod/passenger.pp
因此,在您的情况下,您还可以执行以下建议之一:
在learn-tomcat
的模块init.pp
中,将tomcat
类重命名为learn-tomcat
,然后将其重命名为:
include learn-tomcat
将文件init.pp
重命名为tomcat.pp
,然后将其实例化为:
include learn-tomcat::tomcat