testing清单时Puppet错误

前缀:我搜查了这个,但事实上,有任何事情可以导致这个问题,我一直无法find解决这个特定的情况。

我有一个木偶大师(3.0.2-1; RHEL6)和/etc/puppet/manifests/site.pp文件包含以下内容:

import 'nodes/nodes.pp' $puppetserver = 'puppet.example.dom' 

自然,服务器领域并不是在使用什么,而是为了保护无辜者而被改变了。

nodes / nodes.pp文件包含:

 node 'agent1.example.dom' { include users, } 

用户类在/ etc / puppet / modules / users下。 清单/ init.pp文件包含:

 class users { group { 'admins': ensure => 'present', gid => '501', } user { 'user1': ensure => 'present', uid => '10000', gid => '501', home => '/home/user1', password_max_age => '60', password_min_age => '1', shell => '/bin/bash', } } 

如果我删除“包含用户”,则从nodes.pp文件开始应用目录:

 Info: Retrieving plugin Info: Caching catalog for agent1.example.dom Info: Applying configuration version '1357858753' Notice: Finished catalog run in 0.02 seconds 

但是,当我包含它时出现以下错误:

 [root@agent1 ~]# puppet agent --test --noop Info: Retrieving plugin Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse for environment production: Syntax error at '}' at /etc/puppet/manifests/nodes/nodes.pp:3 on node agent1.example.dom Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run 

这让我觉得我有一个init.pp文件中的语法错误,但我不知道它会是什么。 也许我没有这个正确的configuration,或者我错误地连接了各个部分?

我已经尝试没有逗号在nodes.pp文件以及。 我也尝试过在用户init.pp文件的最后一行没有逗号以及。 我试过了在组定义和用户定义之间的一条空行。 无论我做出什么小改变,我都会得到相同的结果。

我也试过把节点定义直接放到site.pp文件中,但同样的错误发生。 只是从以前的不同位置(site.pp vs nodes / nodes.pp)。

连接到服务器已经使用从agent1到puppet master上的端口8140的telnetvalidation。

有任何想法吗? 代理也是v3.0.2-1,但是是RHEL5。 我还没有testing过RHEL6代理。

编辑:我用–debug选项运行testing。 输出在这里: http : //pastebin.com/zNs5DvCD

编辑2:我没有申报之前,类/模块。 我用puppet apply /etc/puppet/modules/users/manifests/users.pp (更改文件名后)。 这现在给我以下错误:

 [root@agent1 puppet]# puppet agent --test --noop Info: Retrieving plugin Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class users for agent1 on node agent1 Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run 

所以,一些改变。 语法错误消失了,但无法find类。

我按照Sirex的build议在http://ask.puppetlabs.com上发布。 有人指出,我已经将文件模块清单重命名为users.pp,但它应该是init.pp,根据内置在Puppet中的类和子类的自动加载。

删除后, include users – 这只是一个我可以看到的眼睛。

你应该能够ensure => present也是

试试puppetparsing器validation.pp

尝试傀儡皮棉

首先,你必须将类重新命名为init.pp,否则Puppet将无法find它。

其次,运行木偶申请与类定义的文件什么都不做 。 如果你想用puppet apply来testing你的类,你可以把它放在tests / init.pp中

 include users 

然后,你可以用下面的方法testing这个类:

 puppet apply modules/users/tests/init.pp 

第三,包含语句(nodes.pp)的后面需要去。

亲切的问候,Ger。