Wednesday, November 25, 2020

Error: Facter: error while resolving custom facts in /opt/puppetlabs/puppet/cache/lib/facter/packages_of_interest.rb: undefined local variable or method `package' for main:Object Did you mean? packages

 

PROBLEM:

puppet agent -t

Info: Using configured environment 'production'

Info: Retrieving pluginfacts

Info: Retrieving plugin

Info: Retrieving locales

Info: Loading facts

Error: Facter: error while resolving custom facts in /opt/puppetlabs/puppet/cache/lib/facter/packages_of_interest.rb: undefined local variable or method `package' for main:Object

Did you mean?  packages

Info: Caching catalog for server.com

Info: Applying configuration version '1606329246'

Notice: Applied catalog in 1.40 seconds

SOLUTION:

Looking at the subroutine in packages_of_interest.rb, replace package with "matching_package" gets rid of that error.

Adding the the package name to the error message shows which package.  I changed line 57 from

from

      puts "unknown provider passed (#{package[:provider]})"

to

      puts "unknown provider passed (#{matching_package[:provider]}) for package (#{matching_package[:name]})"

The agent replaces this file, so copy the modified file into place once the agent says it updates package_of_interest.rb

This is the error message now:

"unknown provider passed (pip2) for package (javapackages)"

even though pip2 exists on the system

I'm opening a ticket with Support since this seems like a bug.

 EOS

4/14/21 Posted at https://stackoverflow.com/questions/67097723/puppet-agent-t-throws-error-facter-error-while-resolving-custom-facts-p/67097724#67097724

Tuesday, November 24, 2020

Puppet executable missing puppet gem

 

PROBLEM:

[root@MoM 2019.8.4]# puppet agent -t;

Traceback (most recent call last):

        1: from /opt/puppetlabs/server/apps/bolt-server/bin/puppet:23:in `<main>'

/opt/puppetlabs/server/apps/bolt-server/bin/puppet:23:in `load': cannot load such file -- /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/puppet-6.19.1/bin/puppet (LoadError)

[root@MoM 2019.8.4]#

SOLUTION:

Check the PATH environment variable.  If the problem persists after changing PATH, then do:


cp -p /opt/puppetlabs/puppet/bin/puppet /opt/puppetlabs/puppet/bin/puppet.orig

 

/opt/puppetlabs/puppet/bin/gem install puppet -v 6.19.1

 

[root@MoM 2019.8.4]# puppet agent -t;

Info: Using configured environment 'production'

Info: Retrieving pluginfacts

Info: Retrieving plugin

Info: Retrieving locales

Info: Loading facts

Info: Caching catalog for MoM.wrk.fs.usda.gov

Info: Applying configuration version '1606189208'

Notice: Applied catalog in 33.42 seconds

[root@MoM 2019.8.4]#

EOS

Monday, November 16, 2020

Warning: MCollective and Activemq have been removed from PE 2019.0+, but the puppet_enterprise::profile::master::mcollective class is still being applied.

 PROBLEM:

$ puppet agent -t

Info: Using configured environment 'production'

Info: Retrieving pluginfacts

Info: Retrieving plugin

Info: Retrieving locales

Info: Loading facts

Info: Caching catalog for fsxopsx1697.wrk.fs.usda.gov

Info: Applying configuration version '1605550196'

Warning: MCollective and Activemq have been removed from PE 2019.0+, but the puppet_enterprise::profile::master::mcollective class is still being applied. Please remove this class from your classification.

Warning: /Stage[main]/Puppet_enterprise::Profile::Master::Mcollective/Notify[puppet_enterprise::profile::master::mcollective-still-applied]/message: defined 'message' as 'MCollective and Activemq have been removed from PE 2019.0+, but the puppet_enterprise::profile::master::mcollective class is still being applied. Please remove this class from your classification.'

Warning: MCollective and Activemq have been removed from PE 2019.0+, but the puppet_enterprise::profile::mcollective::peadmin class is still being applied. Please remove this class from your classification.

Warning: /Stage[main]/Puppet_enterprise::Profile::Mcollective::Peadmin/Notify[puppet_enterprise::profile::mcollective::peadmin-still-applied]/message: defined 'message' as 'MCollective and Activemq have been removed from PE 2019.0+, but the puppet_enterprise::profile::mcollective::peadmin class is still being applied. Please remove this class from your classification.'

Notice: Applied catalog in 32.16 seconds

SOLUTION:

Query the node groups into q.hocon to find which Node Groups have mcollective classes

$ grep -i mcollective q.hocon

$ curl -k -X GET https://$(hostname -f):4433/classifier-api/v1/groups --cert /etc/puppetlabs/puppet/ssl/certs/$(hostname -f).pem --key /etc/puppetlabs/puppet/ssl/private_keys/$(hostname -f).pem --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem -H "Content-Type: application/json" | python -m json.tool > q.hocon

$ vim q.hocon

EOS

Friday, November 13, 2020

Class[Puppet_enterprise]: has no parameter named 'mcollective_middleware_hosts' on node mom.com

 PROBLEM:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Class[Puppet_enterprise]: has no parameter named 'mcollective_middleware_hosts' on node mom.com

Warning: Not using cache on failed catalog

Error: Could not retrieve catalog; skipping run

SOLUTION:
https://puppet.com/docs/pe/2018.1/removing_mcollective.html
Essentially, go into the console >> PE Infrastructure >> Classes >> Class: puppet_enterprise
and remove mcollective parameter (for Puppet>5), or set it to "disabled" for Puppet 5.

Wednesday, July 15, 2020

Console started, but browser won't connect. Curl gets 404

PROBLEM:

Chrome nor Firefox wouldn't load console login screen.

Curling the url on port 80 give 404 errors, port 443 gives 303 errors (or visa versa)

SOLUTION:

Did this from L-Ubuntu commandline, and it started working:

wget https://192.168.1.138     -O /dev/tty --no-check-certificqate

EOS


Monday, June 15, 2020

Client Error: /Stage[main]/Puppet_agent::Install/Package[puppet-agent]/ensure: change from '5.5.18-1.el7' to '5.5.17'

PROBLEM:

[root@client ~]# puppet agent -t

Info: Using configured environment 'production'

Info: Retrieving pluginfacts

Info: Retrieving plugin

Info: Retrieving locales

Info: Loading facts

Info: Caching catalog for client.com

Info: Applying configuration version '1592088269'

Error: Could not update: Execution of '/bin/yum -d 0 -e 0 -y downgrade puppet-agent-5.5.17' returned 1: Error: Nothing to do

Error: /Stage[main]/Puppet_agent::Install/Package[puppet-agent]/ensure: change from '5.5.18-1.el7' to '5.5.17' failed: Could not update: Execution of '/bin/yum -d 0 -e 0 -y downgrade puppet-agent-5.5.17' returned 1: Error: Nothing to do

Notice: Applied catalog in 3.95 seconds

[root@client ~]#  

SOLUTION:

https://puppet.com/docs/pe/latest/installing_agents.html

Add classes to the PE Master node group for each agent platform used in your environment. For example, pe_repo::platform::el_7_x86_64.

 

If that doesn't work, try deploying the production environment.

puppet access login --service-url https://$(hostname -f):4433/rbac-api --lifetime 5d

puppet code deploy production --wait



Saturday, June 13, 2020

Error 500 on SERVER: Server Error: Could not find class puppet_agent for mom.com on node mom.com

PROBLEM:
[root@MoM]# puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not find class puppet_agent for mom.com on node mom.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
SOLUTION:
Deploy the production environment.
puppet access login --service-url https://$(hostname -f):4433/rbac-api --lifetime 5d                              puppet code deploy production --wait
puppet agent -t

Also, make sure these lines are in Puppetfile:  
   mod 'puppetlabs-puppet_agent'
   mod 'puppetlabs-stdlib'