Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-6517

undefined method `backtrace' for Puppet::Error:Class with package with unresolvable source

    XMLWordPrintable

    Details

    • Template:
    • Epic Link:
    • Team:
      Agent
    • Story Points:
      1
    • Sprint:
      Agent 2017-05-31
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      If the rpm provider failed to query a package source, it would generate a different error unrelated to the original problem. This fix ensures the original error is preserved and reported.
    • QA Risk Assessment:
      Manual
    • QA Risk Assessment Reason:
      This should be a manual test

      Description

      Puppet throws an ugly error that crashes the catalog application, when the source of the package cannot be resolved by dns.

      The error should be caught correctly and just this resource should fail.

      Puppet Code to trigger the issue:

      # /root/package-test.pp
        package { foo:
          ensure   => 'latest',
          provider => 'rpm',
          source   =>
        "http://cannotresolve.foo/foo.rpm",
        }
      

      # puppet apply --debug --trace --evaltrace /root/package-test.pp
       ...
      Info: /Stage[main]/Main/Package[foo]: Starting to evaluate the resource
      Debug: Executing: '/usr/bin/rpm -q foo --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n'
      Debug: Executing: '/usr/bin/rpm -q foo --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n --whatprovides'
      Debug: Executing: '/usr/bin/rpm -q --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n -p http://cannotresolve.foo/foo.rpm'
      Error: Could not update: undefined method `backtrace' for Puppet::Error:Class
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/execution.rb:105:in `rescue in execfail'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/execution.rb:102:in `execfail'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider.rb:126:in `execfail'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/rpm.rb:135:in `latest'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/rpm.rb:147:in `install'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/package/rpm.rb:181:in `update'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type/package.rb:112:in `block (3 levels) in <module:Puppet>'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/property.rb:427:in `set'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/property.rb:501:in `sync'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:189:in `sync'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:114:in `sync_if_needed'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:79:in `perform_changes'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:20:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:212:in `apply'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:228:in `eval_resource'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:151:in `call'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:151:in `block (2 levels) in evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:386:in `block in thinmark'
      /opt/puppetlabs/puppet/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:385:in `thinmark'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:151:in `block in evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:118:in `traverse'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:142:in `evaluate'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:222:in `block in apply'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:155:in `with_destination'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/report.rb:118:in `as_logging_destination'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:221:in `apply'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:171:in `block in apply_catalog'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:223:in `block in benchmark'
      /opt/puppetlabs/puppet/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:222:in `benchmark'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:170:in `apply_catalog'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:315:in `run_internal'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:186:in `block in run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:65:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:240:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:185:in `run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:350:in `apply_catalog'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:274:in `block in main'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:65:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:240:in `override'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:225:in `main'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:170:in `run_command'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:344:in `block in run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:540:in `exit_on_fail'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:344:in `run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:128:in `run'
      /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:72:in `execute'
      /opt/puppetlabs/puppet/bin/puppet:5:in `<main>'
      Error: /Stage[main]/Main/Package[foo]/ensure: change from absent to latest failed: Could not update: undefined method `backtrace' for Puppet::Error:Class
      Info: /Stage[main]/Main/Package[foo]: Evaluated in 0.14 seconds
      Info: Class[Main]: Starting to evaluate the resource
      Debug: Class[Main]: Resource is being skipped, unscheduling all events
      ...
      

      # /usr/bin/rpm -q --qf "%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n" -p http://cannotresolve.foo/foo.rpm
      curl: (6) Could not resolve host: cannotresolve.foo; Name or service not known
      error: open of http://cannotresolve.foo/foo.rpm failed: No such file or directory
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              eric.delaney Eric Delaney
              Reporter:
              pgassmann Philipp Gassmann
              QA Contact:
              Eric Delaney Eric Delaney
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support