运行 Puppet 时出现以下错误:
$ sudo /opt/puppetlabs/bin/puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, Invalid tag '#<puppet::resource::type:0x5d1c8c0d>' at /etc/puppetlabs/code/environments/production/modules/haproxy/manifests/listen.pp:121:6 at /etc/puppetlabs/code/environments/production/manifests/site.pp:1075 on node steven.ca.seevibes.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
manifests/site.pp
包括以下内容:
704 node 'steven.ca.seevibes.com' {
...
1048 class{'haproxy':
1049 service_ensure => running,
1050 package_ensure => present,
1051 restart_command => '/usr/bin/service haproxy reload',
1052 global_options => {
1053 log => '/dev/log local0',
1054 pidfile => '/var/run/haproxy.pid',
1055 maxconn => 4000,
1056 user => 'haproxy',
1057 group => 'haproxy',
1058 daemon => '',
1059 stats => 'socket /var/lib/haproxy/stats', },
1060 defaults_options => {
1061 log => 'global',
1062 option => [ 'redispatch', ],
1063 retries => 3,
1064 maxconn => 500,
1065 timeout => [
1066 'http-request 10s',
1067 'queue 1m',
1068 'connect 10s',
1069 'client 1m',
1070 'server 1m',
1071 'check 10s', ],
1072 }
1073 }
1074
1075 haproxy::listen{'console-rabbitmq':
1076 ipaddress => $ipaddress,
1077 ports => '15672',
1078 mode => 'http',
1079 options => {
1080 balance => 'roundrobin',
1081 mode => 'http',
1082 timeout => [ 'server 1m', 'client 1m', ],
1083 option => [
1084 'httplog',
1085 'httpchk',
1086 ],
1087 },
1088 }
...
1276 }
而这个分界线的确切位置是(基于github.com/puppetlabs/puppetlabs-haproxy@f8c5f27):
86 define haproxy::listen (
87 $ports = undef,
...
99 $section_name = $name,
...
104 ) {
...
121 if defined(Haproxy::Backend[$section_name]) {
122 fail("An haproxy::backend resource was discovered with the same name (${section_name}) which is not supported")
123 }
我自己不实例化haproxy::backend
资源:我只使用haproxy::listen
。
我不知道该如何调试它。
根据我在代码中读到的内容,我本来期望$section_name
等于console-rabbitmq
,但事实并非如此。
$ puppet --version
4.6.2
$ puppetserver --version
puppetserver version: 2.5.0
答案1
这似乎是该标签在内存中的位置问题,需要重新启动 puppetserver 服务。这对我有用:
[rnelson0@puppet ~]$ sudo puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, Invalid tag '#<puppet::resource::type:0x5b351356>' at /etc/puppetlabs/code/environments/production/modules/postgresql/manifests/server/db.pp:17:8 at /etc/puppetlabs/code/environments/production/modules/puppetdb/manifests/database/postgresql.pp:26 on node puppet.nelson.va
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
[rnelson0@puppet ~]$ sudo systemctl restart puppetserver
[rnelson0@puppet ~]$ tail -f /var/log/messages
tail: cannot open ‘/var/log/messages’ for reading: Permission denied
tail: no files remaining
[rnelson0@puppet ~]$ sudo tail -f /var/log/messages
Oct 6 12:02:46 puppet systemd: Stopping puppetserver Service...
Oct 6 12:02:47 puppet systemd: Starting puppetserver Service...
Oct 6 12:02:47 puppet java: OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Oct 6 12:03:25 puppet systemd: Started puppetserver Service.
Oct 6 12:03:57 puppet puppet-agent[22351]: (/Stage[main]/Profile::Base/Exec[shosts.equiv]/returns) executed successfully
Oct 6 12:03:59 puppet puppet-agent[22351]: Applied catalog in 6.18 seconds