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

Base class for JSON/msgpack indirection termini calls log_exception() wrong

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 3.8.1
    • Fix Version/s: PUP 4.3.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Story Points:
      1
    • Sprint:
      Client 2015-08-19
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      If an exception occurred while serializing objects to json or msgpack, puppet generated a new exception while logging the original exception, causing the reason for the original exception to be lost.

      Description

      In Puppet::Indirector::JSON, Puppet.log_exception() is called without the required exception as the first argument value, instead the message is passed.

      Puppet.log_exception "Could not save #{self.name} #{request.key}: #{detail}"
      

      While it should really be:

      Puppet.log_exception(detail, "Could not save #{self.name} #{request.key}: #{detail}")
      

      This breaks further along in format_exception() as it attempts to get the exception message attribute but finds a string:

      Error: Could not retrieve catalog from remote server: undefined method `message' for #<String:0x00000003efda28>
      /opt/ruby2.0/lib/vendor_ruby/2.0.0/puppet/util/logging.rb:70:in `format_exception'
      /opt/ruby2.0/lib/vendor_ruby/2.0.0/puppet/util/logging.rb:45:in `log_exception'
      /var/lib/puppet/lib/puppet/indirector/catalog/json_timestamped.rb:18:in `rescue in save'
      /var/lib/puppet/lib/puppet/indirector/catalog/json_timestamped.rb:13:in `save'
      /opt/ruby2.0/lib/vendor_ruby/2.0.0/puppet/indirector/indirection.rb:206:in `find'
      /opt/ruby2.0/lib/vendor_ruby/2.0.0/puppet/configurer.rb:294:in `block in retrieve_new_catalog'
      /opt/ruby2.0/lib/vendor_ruby/2.0.0/puppet/util.rb:335:in `block in thinmark'
      /opt/ruby2.0/lib/2.0.0/benchmark.rb:296:in `realtime'
      /opt/ruby2.0/lib/vendor_ruby/2.0.0/puppet/util.rb:334:in `thinmark'
      /opt/ruby2.0/lib/vendor_ruby/2.0.0/puppet/configurer.rb:293:in `retrieve_new_catalog'
      /opt/ruby2.0/lib/vendor_ruby/2.0.0/puppet/configurer.rb:61:in `retrieve_catalog'
      /opt/ruby2.0/lib/vendor_ruby/2.0.0/puppet/configurer.rb:106:in `prepare_and_retrieve_catalog'
      /opt/ruby2.0/lib/vendor_ruby/2.0.0/puppet/configurer.rb:202:in `run_internal'
      /opt/ruby2.0/lib/vendor_ruby/2.0.0/puppet/configurer.rb:134:in `block in run'
      ...

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              tdevelioglu Taylan Develioglu
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support