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

Facter sometimes complains about 'no implicit conversion of nil into String' while determining processor speed on linux

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: FACT 4.0.50
    • Component/s: None
    • Labels:
    • Environment:

      Linux, Ubuntu 20.04.1, puppet 7.3.0, facter 4.0.49

    • Template:
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Correctly handle processor speed values whose log10 is not in (3, 6, 9, 12).
    • QA Risk Assessment:
      Needs Assessment

      Description

      With an up-to-date puppet-agent package on Ubuntu 20.04.1 LTS I'm sometimes getting the following error when showing all facts:

      $ sudo /opt/puppetlabs/puppet/bin/puppet facts show >/dev/null
      Error: Facter: no implicit conversion of nil into String
      

      If I run the command with backtraces activated I get the following output:

      Error: Facter: no implicit conversion of nil into String
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/util/facts/unit_converter.rb:23:in `+'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/util/facts/unit_converter.rb:23:in `hertz_to_human_readable'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/facts/linux/processors/speed.rb:11:in `call_the_resolver'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/internal/core_fact.rb:16:in `block in create'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/benchmarking/timer.rb:18:in `measure'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/internal/core_fact.rb:15:in `create'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/internal/internal_fact_manager.rb:47:in `block in resolve_sequentially'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/internal/internal_fact_manager.rb:44:in `each'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/internal/internal_fact_manager.rb:44:in `resolve_sequentially'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/internal/internal_fact_manager.rb:12:in `resolve_facts'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact_manager.rb:24:in `resolve_facts'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter.rb:385:in `values'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/cli/cli.rb:126:in `arg_parser'
      /opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
      /opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
      /opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
      /opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.0.1/lib/thor/invocation.rb:116:in `invoke'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter.rb:43:in `resolve'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/facts/facter.rb:107:in `find_with_options'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/facts/facter.rb:37:in `find'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:223:in `find'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/face/facts.rb:148:in `block (3 levels) in <top (required)>'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/interface/action.rb+eval[wrapper]:261:in `show'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/face_base.rb:254:in `main'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:437:in `run_command'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:421:in `block in run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:735:in `exit_on_fail'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:421:in `run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:143:in `run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:77:in `execute'
      /opt/puppetlabs/puppet/bin/puppet:5:in `<main>'
      

      If I'm not mistaken the error happens when /proc/cpuinfo reports a frequency of less then 1 GHz. I'll open a PR at github to address the issue.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            bartolin Christian Bartolomäus
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support