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.
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`