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

No comments:

Post a Comment