Until now, I think that you can use Puppet for your own projects. But, like codding, you will have mistakes while deploy to servers. I will list some of errors I sometimes get.
Agenda
1. Puppet Agent Can not connect to Puppet Master
1. Puppet Agent Can not connect to Puppet Master
Error message :
Warning: Unable to fetch my node definition, but the agent run will continue:
Warning: No route to host - connect(2)
Info: Retrieving pluginfacts
Error: /File[/var/lib/puppet/facts.d]: Failed to generate additional resources using 'eval_generate': No route to host - connect(2)
Error: /File[/var/lib/puppet/facts.d]: Could not evaluate: Could not retrieve file metadata for puppet://puppet-master.summernguyen.net/pluginfacts: No route to host - connect(2)
Info: Retrieving plugin
Error: /File[/var/lib/puppet/lib]: Failed to generate additional resources using 'eval_generate': No route to host - connect(2)
Error: /File[/var/lib/puppet/lib]: Could not evaluate: Could not retrieve file metadata for puppet://puppet-master.summernguyen.net/plugins: No route to host - connect(2)
Error: Could not retrieve catalog from remote server: No route to host - connect(2)
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Error: Could not send report: No route to host - connect(2)
Fix :
- Ensure that Server / Services Puppet master is running.
- Ensure that Puppet agent can connect to Puppet master using port 8140.
telnet puppet-master.summernguyen.net 8140
Error message :
[root@puppet-agent ~]# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find default node or by name with 'puppet-agent.summernguyen.net, puppet-agent.summernguyen, puppet-agent, puppet-agent.local.ttvonline.info, puppet-agent.local.ttvonline, puppet-agent.local' on node puppet-agent.summernguyen.net
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Reason :
- You didn’t defined the Node using the node keyword.
- Puppet master somehow doesn’t regconize your code.
Fix:
- Restart Puppet Master Service
- code your manifest using the keyword node
node 'puppet-agent.summernguyen.net' {
}
Error message :
[root@puppet-agent ~]# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse for environment production: Syntax error at 'present'; expected '}' at /etc/puppet/manifests/site.pp:6 on node puppet-agent.summernguyen.net
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Reason : Syntax error at line /etc/puppet/manifests/site.pp:6
Fix : step by step
- Check the brackets ( ’ , “, [ ) if there missing the closing brackets.
- Check the current block of code only
Error message :
[root@puppet-agent ~]# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type user1 at /etc/puppet/manifests/site.pp:7 on node puppet-agent.summernguyen.net
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Reason : Undefined resource type user1 at /etc/puppet/manifests/site.pp:7
Fix :
- Maybe you are mistyping at /etc/puppet/manifests/site.pp:7, fix it.
- Maybe you are calling a resource type from uninstalled module, Just check and install this module.
- Maybe Puppet Master doesn’t regconize your new code, restart puppet master service.
Error message :
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for puppet-agent.summernguyen.net
Error: Failed to apply catalog: Could not find dependency File[/var/www/html] for File[/var/www/html/web2] at /etc/puppet/manifests/site.pp:35
Reasons : Catalog File[/var/www/html] which is required by File[/var/www/html/web2] is not defined.
Fix :
- Check for the declaration of this resource.
- If it is not neccessary, remove the require parameter.
TIPS
While debugging Puppet Manifest, keep in mind that Puppet throw the exception very clearly about the Location of the error , follow it.
Puppet Master sometimes doesn’t regconize your latest code, restarting Puppet master services may help.
Previous Topic : PUPPET AUTOMATION SERIES - PART 5 - HOW TO USE COMMUNITY MODULE : NGINX