Error 400 on puppet SERVER - puppet

On agent node:
root#agent2-VirtualBox:/var/lib/puppet# 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 'agent2-virtualbox.servicemesh.com, agent2-virtualbox.servicemesh, agent2-virtualbox, agent2-VirtualBox.servicemesh.com, agent2-VirtualBox.servicemesh, agent2-VirtualBox' on node agent2-virtualbox.servicemesh.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
root#agent2-VirtualBox:/var/lib/puppet#
On the puppet master side:
root#puppetmaster:~# puppet cert sign --all
Error: No waiting certificate requests to sign
root#puppetmaster:~#
How to resolve this?

You need to check you site.pp and make sure you either have a default node definition defined or a node definition for the FQDN of your agent.
https://docs.puppet.com/puppet/latest/reference/lang_node_definitions.html
for example:
node 'agent2-virtualbox.servicemesh.com' {
import ntp
}

Related

Puppet Error : Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Could not find class

I am testing this out and getting an error on the Puppet agent node
[root#pagent1 ~]# puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Could not find class ::nginx for pagent1.testcentos7.com (file: /etc/puppetlabs/code/environments/production/manifests/site.pp, line: 3, column: 3) on node pagent1.testcentos7.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Content of these classes from the Puppet server:
[root#pmaster ~]# cat /etc/puppetlabs/code/environments/production/manifests/site.pp
node pagent1.testcentos7.com {
class { 'nginx': }
}
[root#pmaster ~]# cat /etc/puppetlabs/code/environments/production/modules/nginx/manifests/manifests/init.pp
class nginx {
contain nginx::install
}
[root#pmaster ~]# cat /etc/puppetlabs/code/environments/production/modules/nginx/manifests/install.pp
class nginx::install {
package { 'install_nginx':
name => 'nginx',
ensure => 'present',
}
}
Syntax check shows this error:
[root#pmaster ~]# puppet parser validate /etc/puppetlabs/code/environments/production/modules/nginx/manifests/manifests/init.pp
Error: Could not parse for environment production: Unacceptable location. The name 'nginx' is unacceptable in file '/etc/puppetlabs/code/environments/production/modules/nginx/manifests/manifests/init.pp' (file: /etc/puppetlabs/code/environments/production/modules/nginx/manifests/manifests/init.pp, line: 7, column: 1)
NOTE: Created module 'nginx' and its classes using Puppet Development Kit(PDK).
Is that a bug or something or I made a mistake with the class name?.
Related thread I found is https://groups.google.com/forum/embed/#!topic/puppet-users/nxbwCvWrgMI but would like to have someone simplify this for me
Solved this by moving 'init.pp' to the path /etc/puppetlabs/code/environments/production/modules/nginx/manifests where install class file 'install.pp' exists.
For more clarity, I put both the files 'init.pp' and 'install.pp' in the same location directory /etc/puppetlabs/code/environments/production/modules/nginx/manifests to solve this.

Puppet Agent Could not retrieve catalog

I installed Maven module in Master machine using this command:
puppet module install maestrodev-maven --version 1.4.0
It installed it successfully in /etc/puppet/modules/
Afterwards I added following code inside the file /etc/puppet/manifests/site.pp of master machine
node 'test02.edureka.com'
{
include maven
}
Now, when I run below command on Puppet Agent machine
puppet agent -t
It gives error:
root#test02:~# puppet agent -t
Warning: Unable to fetch my node definition, but the agent run will continue:
Warning: execution expired
Info: Retrieving pluginfacts
Error: /File[/var/lib/puppet/facts.d]: Failed to generate additional resources using 'eval_generate': execution expired
Error: /File[/var/lib/puppet/facts.d]: Could not evaluate: Could not retrieve file metadata for puppet://test01.edureka.com/pluginfacts: execution expired
Info: Retrieving plugin
Error: /File[/var/lib/puppet/lib]: Failed to generate additional resources using 'eval_generate': execution expired
Error: /File[/var/lib/puppet/lib]: Could not evaluate: Could not retrieve file metadata for puppet://test01.edureka.com/plugins: execution expired
Info: Loading facts
Error: JAVA_HOME is not defined correctly.
We cannot execute
Could not retrieve fact='maven_version', resolution='': undefined method `split' for nil:NilClass
Error: Could not retrieve catalog from remote server: execution expired
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Error: Could not send report: execution expired
root#test02:~#
puppet.conf file on master:
puppet.conf file on agent:
Error screenshot:

Puppet can't deactivate nodes

I'm using Puppet with PuppetDb. The two are connected and I can see PuppetDb update whenever I add or update a node.
But when I try to deactivate a node with puppet node deactivate nodeName I get back:
Warning: Error connecting to puppetdb on 8081 at route /pdb/cmd/v1?checksum=36a4313be5bac718badc45495f0266bf87c7a806&version=3&certname=v-hub-1.5659710c-33d5-45f2-a477-6
ccf1357e1ac.local.dockerapp.io&command=deactivate_node, error message received was 'SSL_connect SYSCALL returned=5 errno=0 state=unknown state'. Failing over to the next
PuppetDB server_url in the 'server_urls' list
Error: Failed to execute '/pdb/cmd/v1?checksum=36a4313be5bac718badc45495f0266bf87c7a806&version=3&certname=v-hub-1.5659710c-33d5-45f2-a477-6ccf1357e1ac.local.dockerapp.i
o&command=deactivate_node' on at least 1 of the following 'server_urls': https://puppetdb:8081
Error: undefined method `[]' for #<Puppet::Util::Log:0x00000003a15178>
Error: Try 'puppet help node deactivate' for usage
Any suggestions on how to debug this? I've tried deleting and regenerating the certificate with puppet cert generate puppetdb. As mentioned when it comes to creating or updating nodes on PuppetDb there is no problem.
Puppetserver version: 2.7.2

Puppet master and client on one machine

I would like to test the puppet client on the same machine as the master resides. I followed this tutorial "http://www.elsotanillo.net/2011/08/installing-puppet-master-and-client-in-the-same-host-the-debian-way/". He was saying that generating SSL at the right moment is the trick involved in keeping master and client communicating successfully in one machine. I killed puppet master process, generated puppet.conf file as he given in that link, installed puppet client, but when I try to generate SSL using the below command. It failed. You could see the log below.
puppetd --no-daemonize --onetime --verbose --waitforcert 30
I replaced puppetd with puppet agent to make it work in latest version of puppet
Warning: Unable to fetch my node definition, but the agent run will
continue:
Warning: Connection timed out - connect(2)
Info: Retrieving pluginfacts
Error: /File[/home/lhdadmin/.puppet/var/facts.d]: Failed to generate
additional resources using 'eval_generate': Connection timed out -
connect(2)
Error: /File[/home/lhdadmin/.puppet/var/facts.d]: Could not evaluate:
Could not retrieve file metadata for puppet://puppet/pluginfacts:
Connection timed out - connect(2)
Info: Retrieving plugin
Error: /File[/home/lhdadmin/.puppet/var/lib]: Failed to generate
additional resources using 'eval_generate': Connection timed out -
connect(2)
Error: /File[/home/lhdadmin/.puppet/var/lib]: Could not evaluate:
Could not retrieve file metadata for puppet://puppet/plugins:
Connection timed out - connect(2)
I tried to install puppetdb thinking that was the missing component could be triggering the above error, but it couldn't find puppetdb module to install. see the errors below
sudo puppet resource package puppetdb ensure=latest
Error: Could not update: Execution of '/usr/bin/apt-get -q -y -o
DPkg::Options::=--force-confold install puppetdb' returned 100:
Reading package lists... Building dependency tree... Reading state
information... E: Unable to locate package puppetdb Error:
/Package[puppetdb]/ensure: change from purged to latest failed: Could
not update: Execution of '/usr/bin/apt-get -q -y -o
DPkg::Options::=--force-confold install puppetdb' returned 100:
Reading package lists... Building dependency tree... Reading state
information... E: Unable to locate package puppetdb
package { 'puppetdb': ensure => 'purged', }
Aah , I think you have not mentioned your puppet class in init.pp or have defined your node in node.pp .
If you don't want to use puppetdb then please don't include in your puppet/puppet.conf file and if you want to use it then cross check the puppetdb by login in manually by the user mentioned in puppet.conf file.
storeconfigs = true
dbname = puppet-db
dbadapter = mysql
dbuser = puppet-user
dbpassword = puppet
dbserver = localhost
Also check for the proper repo in /etc/apt/sources.list , E: Unable to locate package puppetdb this error generally occurs due to failed internet connectivity, or if it is unable to reach the server.

Puppet-Master / Puppet-Agent Deployment fails due to the puppet modules metadata.json file permissions

I am using the Puppet Master / Puppet Agent deployment in CentOS 6.5 64bits.
My problem is about doing the request from Puppet Agent in order to start the puppet modules's installation. When I execute the following commandline from Puppet-Agent:
puppet agent --server <internal-puppet-server-hostname> --test
The ouput result is:
Info: Retrieving pluginfacts
Error: /File[/var/lib/puppet/facts.d]: Failed to generate additional resources using 'eval_generate': Error 400 on SERVER: Permission denied - /etc/puppet/modules/yum/metadata.json
Error: /File[/var/lib/puppet/facts.d]: Could not evaluate: Could not retrieve file metadata for puppet://<internal-puppet-server-hostname>/pluginfacts: Error 400 on SERVER: Permission denied - /etc/puppet/modules/yum/metadata.json
Info: Retrieving plugin
Error: /File[/var/lib/puppet/lib]: Failed to generate additional resources using 'eval_generate': Error 400 on SERVER: Permission denied - /etc/puppet/modules/yum/metadata.json
Error: /File[/var/lib/puppet/lib]: Could not evaluate: Could not retrieve file metadata for puppet://<internal-puppet-server-hostname>/plugins: Error 400 on SERVER: Permission denied - /etc/puppet/modules/yum/metadata.json
Info: Caching catalog for <internal-puppet-agent-hostname>
Info: Applying configuration version '1440623253'
About the returned response, I show that the problem occurs because of the permissions of metadata.json's file. Then, I've checked the permissions of metadata.json:
-r--------. 1 root root 539 2015-08-18 14:19 metadata.json
Some ideas about error occurs? Thanks.

Resources