在Puppet运行时,'不能将nil转换为string'错误

在尝试使用复制到Puppet模块目录的模块时,当连接到Puppet主服务器时,我的puppet客户端返回'无法从远程服务器检索目录:SERVER上的错误400:无法在string中转换nil'错误。

[root@puppetmaster modules]# rpm -qa *puppet* puppet-2.7.18-1.el6.noarch puppet-server-2.7.18-1.el6.noarch [root@puppetmaster modules]# uname -sr Linux 2.6.32-279.el6.x86_64 

代码全部签出并且有效。 SELinux已打开。

在这种情况下,文件被移动“mv”而不是用“cp”复制。 SELinux不会像使用“cp”那样将文件更改为“mv”目标的默认上下文。

因此,Puppet无法读取模块文件,因此“include”在调用.pp文件中失败。 由于阅读失败,代码被预期为“零”。

validationPuppet模块目录的SELinux属性。

木偶有自己的SELinux设置,你的文件应该设置为它。 如果从其他地方复制,他们将是不正确的。

 [root@puppetmaster modules]# ls -Z drwxr-xr-x. root root unconfined_u:object_r:puppet_etc_t:s0 acroread drwxr-xr-x. root root unconfined_u:object_r:puppet_etc_t:s0 apt drwxr-xr-x. 999 1000 unconfined_u:object_r:admin_home_t:s0 bindserver 

要将其设置恢复为默认设置,您可以运行restorecon -R /etc/puppet ,它将recursion地将所有puppet模块重置为functionSELinux设置,以便在Puppet中使用。

HT:@迈克尔汉普顿