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.