Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-2999

Facter cannot autoload provider from stdlib inside puppetserver repl

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: FACT 4.1.0
    • Component/s: None
    • Labels:
    • Template:
    • Team:
      Night's Watch
    • Story Points:
      2
    • Sprint:
      NW - 2021-03-31, NW - 2021-04-14
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Fix a bug where Facter would fail to execute the first external command when running under JRuby. This issue only appears when running puppetserver from source, packaged versions are not affected.
    • QA Risk Assessment:
      Needs Assessment

      Description

      When starting puppetserver from the repl, I get the following stack trace while trying to resolve facts:

      2021-03-26 08:10:19,454 ERROR [clojure-agent-send-pool-0] [puppetserver] Facter error while resolving custom facts in /Users/aileen/.puppetlabs/opt/puppet/cache/lib/facter/service_provider.rb Could not autoload puppet/provider/service/upstart: Could not autoload puppet/provider/service/debian: Could not autoload puppet/provider/service/init: undefined method `downcase' for nil:NilClass
      backtrace:
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/provider/service/init.rb:24:in `block in <main>'
      org/jruby/RubyModule.java:3249:in `module_eval'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/util/classgen.rb:132:in `genthing'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/util/classgen.rb:33:in `genclass'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/type.rb:1847:in `provide'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/provider/service/init.rb:3:in `<main>'
      org/jruby/RubyKernel.java:1009:in `load'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/util/autoload.rb:78:in `load_file'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/util/autoload.rb:182:in `load'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/type.rb:1780:in `provider'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/type.rb:1832:in `provide'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/provider/service/debian.rb:3:in `<main>'
      org/jruby/RubyKernel.java:1009:in `load'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/util/autoload.rb:78:in `load_file'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/util/autoload.rb:182:in `load'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/type.rb:1780:in `provider'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/type.rb:1832:in `provide'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/provider/service/upstart.rb:1:in `<main>'
      org/jruby/RubyKernel.java:1009:in `load'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/util/autoload.rb:78:in `load_file'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/util/autoload.rb:93:in `block in loadall'
      org/jruby/RubyArray.java:1809:in `each'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/util/autoload.rb:91:in `loadall'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/util/autoload.rb:196:in `loadall'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/metatype/manager.rb:126:in `block in newtype'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/concurrent/lock.rb:10:in `synchronize'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/metatype/manager.rb:73:in `newtype'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/type/service.rb:10:in `<module:Puppet>'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/type/service.rb:8:in `<main>'
      org/jruby/RubyKernel.java:974:in `require'
      uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54:in `require'
      /Users/aileen/.puppetlabs/opt/puppet/cache/lib/facter/service_provider.rb:11:in `<main>'
      org/jruby/RubyKernel.java:1009:in `load'
      /Users/aileen/code/server/puppetserver/ruby/facter/lib/facter/custom_facts/util/loader.rb:129:in `kernel_load'
      /Users/aileen/code/server/puppetserver/ruby/facter/lib/facter/custom_facts/util/loader.rb:112:in `load_file'
      /Users/aileen/code/server/puppetserver/ruby/facter/lib/facter/custom_facts/util/loader.rb:47:in `block in load_all'
      org/jruby/RubyArray.java:1809:in `each'
      /Users/aileen/code/server/puppetserver/ruby/facter/lib/facter/custom_facts/util/loader.rb:45:in `block in load_all'
      org/jruby/RubyArray.java:1809:in `each'
      /Users/aileen/code/server/puppetserver/ruby/facter/lib/facter/custom_facts/util/loader.rb:41:in `load_all'
      /Users/aileen/code/server/puppetserver/ruby/facter/lib/facter/custom_facts/util/collection.rb:120:in `custom_facts'
      /Users/aileen/code/server/puppetserver/ruby/facter/lib/facter/framework/core/fact_loaders/external_fact_loader.rb:20:in `load_custom_facts'
      /Users/aileen/code/server/puppetserver/ruby/facter/lib/facter/framework/core/fact_loaders/external_fact_loader.rb:6:in `custom_facts'
      /Users/aileen/code/server/puppetserver/ruby/facter/lib/facter/framework/core/fact_loaders/fact_loader.rb:57:in `load_custom_facts'
      /Users/aileen/code/server/puppetserver/ruby/facter/lib/facter/framework/core/fact_manager.rb:114:in `all_custom_facts'
      /Users/aileen/code/server/puppetserver/ruby/facter/lib/facter/framework/core/fact_manager.rb:50:in `resolve_fact'
      /Users/aileen/code/server/puppetserver/ruby/facter/lib/facter.rb:549:in `resolve_fact'
      /Users/aileen/code/server/puppetserver/ruby/facter/lib/facter.rb:396:in `value'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/confine/variable.rb:21:in `facter_value'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/confine/variable.rb:57:in `test_value'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/confine/variable.rb:45:in `valid?'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/confine_collection.rb:49:in `block in valid?'
      org/jruby/RubyEnumerable.java:671:in `detect'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/confine_collection.rb:49:in `valid?'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/confiner.rb:44:in `suitable?'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/type.rb:1949:in `block in suitableprovider'
      org/jruby/RubyHash.java:1415:in `each'
      org/jruby/RubyEnumerable.java:842:in `find_all'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/type.rb:1948:in `suitableprovider'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/type.rb:1738:in `defaultprovider'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/type.rb:1901:in `block in default'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/type.rb:844:in `set_default'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/type.rb:2371:in `initialize'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/type/file.rb:537:in `initialize'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/resource.rb:475:in `to_ral'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/resource/catalog.rb:610:in `block in to_catalog'
      org/jruby/RubyArray.java:1809:in `each'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/resource/catalog.rb:602:in `to_catalog'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/resource/catalog.rb:495:in `to_ral'
      /Users/aileen/code/server/puppetserver/ruby/puppet/lib/puppet/settings.rb:1099:in `use'
      uri:classloader:/puppetserver-lib/puppet/server/puppet_config.rb:91:in `initialize_puppet'
      uri:classloader:/puppetserver-lib/puppet/server/master.rb:39:in `initialize'
      

      It doesn't prevent the server from starting, so this isn't pressing, but it looks like the same error as in FACT-2937, which was resolved. Apparently that fix wasn't sufficient for whatever is going on in this environment. We run into this while trying to construct the Puppet settings catalog, which is a Puppet catalog constructed internally on init that enforces file-related settings.

      Note that this does not happen in a package install, only in the repl environment.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              gabriel.nagy Gabriel Nagy
              Reporter:
              maggie Maggie Dreyer
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support