使用类时出现Puppet错误

时间:2015-05-21 14:16:30

标签: puppet

我开始使用puppet管理许多服务器,问题是每当我尝试使用类时, new relic 例如:

 setcookie('username', $_POST['username'], time() + 3600*24*30);
 setcookie('password', $_POST['password'], time() + 3600*24*30);

失败,并返回以下错误:

node 'mynode' {
     class {'newrelic::server::linux':
       newrelic_license_key => '***',
      }
 }

我在主服务器上安装了Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class newrelic::server::linux at /etc/puppet/manifests/site.pp:3 on node mynode ,使用文件,软件包,服务等时一切正常。我做错了什么?

2 个答案:

答案 0 :(得分:5)

目录编译器将在newrelic::server::linux处查找与模块路径中每个目录相关的类newrelic/manifests/server/linux.pp。 (注意:newrelic,不是fsalum-newrelic。)确保您确实安装了模块,使得这样的文件存在于您的模块路径中,并确保它可以被puppetmaster进程读取。

另请注意,“puppetmaster进程可读”不仅仅意味着文件本身的所有权和权限。它还涉及该文件路径中所有目录的所有权和权限,以及可能的其他形式的访问控制,例如ACL和SELinux conext和策略。

答案 1 :(得分:2)

使用像“locate”这样的unix实用程序,找出实际安装新puppet forge模块的位置。

然后查看“basemodulepath”中的/etc/puppet/puppet.conf并检查它所安装的位置是否在路径中

这是我的basemodulepath

basemodulepath = $confdir/environments/production/modules:$confdir/environments/production/local_modules:/etc/puppet/modules

我使用的外部模块位于/ etc / puppet / modules或/ etc / puppet / enviroments / production / modules