Jira (FACT-2937) Puppet facts show logs error when stdlib is installed

5 views
Skip to first unread message

Gheorghe Popescu (Jira)

unread,
Feb 4, 2021, 8:52:04 AM2/4/21
to puppe...@googlegroups.com
Gheorghe Popescu updated an issue
 
Facter / Bug FACT-2937
Puppet facts show logs error when stdlib is installed
Change By: Gheorghe Popescu
When running `puppet facts show` and puppetlabs-stdlib is installed, the following error message is shown:

{noformat}
Error: Could not autoload puppet/provider/service/init: undefined method `downcase' for nil:NilClass
Error: Could not autoload puppet/provider/service/bsd: Could not autoload puppet/provider/service/init: undefined method `downcase' for nil:NilClass
Error: Facter: error while resolving custom facts in /etc/puppetlabs/code/modules/stdlib/lib/facter/service_provider.rb Could not autoload puppet/provider/service/bsd: Could not autoload puppet/provider/service/init: undefined method `downcase' for nil:NilClass
{noformat}

- puppet facts show calls `Facter.resolve` which sets show_legacy to
fals false
- when resolving facts, Facter also load modules facts(stdlib)
- stdlib has a fact that creates a dummy provider: https://github.com/puppetlabs/puppetlabs-stdlib/blob/main/lib/facter/service_provider.rb
- when Facter loads that fact, it calls Puppet to initalize the provider, Puppet tries to see what specific provider is suitable, and when it gets to `init.rb` it calls Facter back, with `operatingsystem`
- because `Facter::Options[:show_legacy]` is false, Facter.value(:operatingsystem) returns `nil`, which breaks the call of `downcase`: https://github.com/puppetlabs/puppet/blob/main/lib/puppet/provider/service/init.rb#L24

This happens because `Facter::Options` is globally set for the entire run.
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Gheorghe Popescu (Jira)

unread,
Feb 4, 2021, 8:52:04 AM2/4/21
to puppe...@googlegroups.com
Gheorghe Popescu created an issue
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2021/02/04 5:51 AM
Priority: Normal Normal
Reporter: Gheorghe Popescu

When running `puppet facts show` and puppetlabs-stdlib is installed, the following error message is shown:

Error: Could not autoload puppet/provider/service/init: undefined method `downcase' for nil:NilClass
Error: Could not autoload puppet/provider/service/bsd: Could not autoload puppet/provider/service/init: undefined method `downcase' for nil:NilClass
Error: Facter: error while resolving custom facts in /etc/puppetlabs/code/modules/stdlib/lib/facter/service_provider.rb Could not autoload puppet/provider/service/bsd: Could not autoload puppet/provider/service/init: undefined method `downcase' for nil:NilClass
  • puppet facts show calls `Facter.resolve` which sets show_legacy to fals
  • when resolving facts, Facter also load modules facts(stdlib)
  • when Facter loads that fact, it calls Puppet to initalize the provider, Puppet tries to see what specific provider is suitable, and when it gets to `init.rb` it calls Facter back, with `operatingsystem`

This happens because `Facter::Options` is globally set for the entire run.

Reply all
Reply to author
Forward
0 new messages