我不知道这是一个错误还是某种误用/错误配置。希望有人可以提供帮助。谢谢!
如果我更改模块或清单目录中的文件,这通常会导致错误,主要是以下类型
无法在节点
在节点
当木偶模块/清单发生变化时会发生这些错误 - 但只发生一次。如果它发生,受影响的木偶代理将使用他们的缓存目录一次。 下次这些代理商请求目录时,它会被完美地编译,一切都会像魅力一样 - 所有错误都消失了。问题是我们有代理商有大型目录。他们的目录运行时间可能超过一分钟,因此应用更改所需的时间将翻倍,最多需要2分钟甚至3分钟。
模块/清单的更改通常由“git pull”执行。但是通过简单的“触摸”操作很容易重现这些错误消息。以下是一些有趣的日志观察及其[共性]。是的AFAICS他们总是出现在三胞胎中。修改后很少发生这样的问题。
>触摸/opt/xxx/dev/puppet/manifests/site.pp
[often] puppet-master[12498]: Could not find class <class> for <node> on <node>
[often] puppet-master[12498]: Could not find class <class> for <node> on <node>
[often] puppet-master[12498]: Could not find class <class> for <node> on <node>
&GT;触摸/opt/xxx/dev/puppet/puppet.conf
[often] puppet-master[12498]: Could not find class <class> for <node> on <node>
[often] puppet-master[12498]: Could not find class <class> for <node> on <node>
[often] puppet-master[12498]: Could not find class <class> for <node> on <node>
[sometimes] puppet-master[12498]: Cannot find definition Class on node <node>
[sometimes] puppet-master[12498]: Cannot find definition Class on node <node>
[sometimes] puppet-master[12498]: Cannot find definition Class on node <node>
[rare] puppet-master[12498]: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type <own custom type> at <class file> on node <node>
[rare] puppet-master[12498]: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type <own custom type> at <class file> on node <node>
[rare] puppet-master[12498]: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type <own custom type> at <class file> on node <node>
&GT;触摸/opt/xxx/dev/puppet/modules/dispatcher/manifests/init.pp
[often] puppet-master[12498]: Could not find class <class not even part of module dispatcher> for <node not even affected by module dispatcher> on <node not even...>
[often] puppet-master[12498]: Could not find class <class not even part of module dispatcher> for <node not even affected by module dispatcher> on <node not even...>
[often] puppet-master[12498]: Could not find class <class not even part of module dispatcher> for <node not even affected by module dispatcher> on <node not even...>
受影响的类和节点似乎是随机选择的。
环境运行于:
> ll /etc/puppet
lrwxrwxrwx 1 root root 34 Mar 7 10:01 auth.conf -> /opt/xxx/dev/puppet/auth.conf
lrwxrwxrwx 1 root root 38 Mar 7 10:01 autosign.conf -> /opt/xxx/dev/puppet/autosign.conf
lrwxrwxrwx 1 root root 40 Mar 7 10:01 fileserver.conf -> /opt/xxx/dev/puppet/fileserver.conf
lrwxrwxrwx 1 root root 36 Mar 7 10:01 puppet.conf -> /opt/xxx/dev/puppet/puppet.conf
> ls -A /opt/xxx/dev/puppet/
auth.conf autosign.conf fileserver.conf .git .gitignore manifests modules .project puppet.conf scripts
> cat /etc/puppet/puppet.conf # on puppetmaster
[main]
logdir = /var/log/puppet
rundir = /var/run/puppet
ssldir = $vardir/ssl
modulepath = /opt/xxx/dev/puppet/modules
manifestdir = /opt/xxx/dev/puppet/manifests
manifest = /opt/xxx/dev/puppet/manifests/site.pp
[agent]
classfile = $vardir/classes.txt
localconfig = $vardir/localconfig
server = <puppetmaster host>
report = true
splaylimit = 0
runinterval = 30
[master]
certname=<puppetmaster host>
reports = http,log
reportdir = /var/lib/puppet/reports/upload
reporturl = http://<puppetmaster host>:3000/reports
> cat /opt/xxx/dev/puppet/manifests/site.pp
import 'nodes.pp'
$puppetserver = <puppetmaster host>
> rpm -qa | egrep "puppet|ruby"
rubygem-rake-0.8.7-2.1.el6.noarch
ruby-mysql-2.8.2-1.el6.x86_64
libselinux-ruby-2.0.94-5.3.el6.x86_64
puppet-3.1.0-1.el6.noarch
rubygem-fastthread-1.0.7-2.el6.x86_64
rubygem-mongrel-1.1.5-3.el6.x86_64
ruby-1.8.7.352-7.el6_2.x86_64
ruby-irb-1.8.7.352-7.el6_2.x86_64
ruby-augeas-0.4.1-1.el6.x86_64
ruby-shadow-1.4.1-13.el6.x86_64
puppetlabs-release-6-6.noarch
rubygems-1.3.7-1.el6.noarch
puppet-server-3.1.0-1.el6.noarch
rubygem-gem_plugin-0.2.3-3.el6.noarch
rubygem-daemons-1.0.10-2.el6.noarch
puppet-dashboard-1.2.22-1.el6.noarch
ruby-libs-1.8.7.352-7.el6_2.x86_64
ruby-rdoc-1.8.7.352-7.el6_2.x86_64
rubygem-json-1.4.6-1.el6.x86_64
答案 0 :(得分:1)
切换到Apache / Passenger / Rack解决方案(并转储WEBrick)似乎解决了这个问题。 其他信息:http://projects.puppetlabs.com/issues/19642
答案 1 :(得分:1)
当我重命名Puppet模块/类时,我发生了这种情况,结果是:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class foo for example on node myhost.example.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
我在Apache + Foreman上使用Passenger服务Puppet,所以我找到的解决方案是重新启动httpd和foreman-proxy:
sudo service httpd restart
sudo service foreman-proxy restart
另外,如果您使用代码版本控制系统(如您所愿:) :),例如git或svn,请确保您实际将更新推送到puppet master。换句话说,检查您的模块是否确实存在于Puppet寻找的位置,例如: /etc/puppet/modules/foo
。我几次绊倒了自己。
答案 2 :(得分:0)
在我的情况下,这是puppet master上的语言环境问题(我的一些清单包含本地化的注释),所以Puppet 3.8无法编译它们。
检查控制台中locale
命令的输出(不应该抱怨任何事情)。
我通过运行sudo dpkg-reconfigure locales
并将下一行插入/etc/default/locale
来修复它:
LC_ALL="ru_RU.UTF-8"
LANG="ru_RU.UTF-8"
LANGUAGE="ru_RU:ru:en"
此外,我正在使用apache2与乘客一起运行Puppet master,所以我还需要替换/etc/init.d/apache2
中的下一个字符串:
ENV="env -i LANG=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
为:
ENV="env -i LANG=ru_RU.UTF-8 LC_ALL=ru_RU.UTF-8 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
事实证明,在C语言环境下启动的Ruby会使所有文件都采用ASCII编码。