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

Logging as JSON broken

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 5.5.0, PUP 5.5.1
    • Fix Version/s: PUP 5.5.3
    • Component/s: None
    • Labels:
      None
    • Template:
      PUP Bug Template
    • Team:
      Coremunity
    • Sprint:
      Platform Core KANBAN
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      The introduction of multi_json in 5.5.0 broke the JSON log destination. This fixes the regression.
    • QA Risk Assessment:
      Needs Assessment

      Description

      Puppet Version: 5.5.1
      Puppet Server Version: n/a
      OS Name/Version: RHEL 7.x

      Running the puppet agent with the --logdest option pointing at a JSON target file causes a Ruby backtrace.

      Desired Behavior:

      Puppet should log as JSON.

      Actual Behavior:

       

      Example output:

      # puppet agent -t --noop --logdest /tmp/foo.json
      /opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/multi_json-1.13.1/lib/multi_json.rb:130:in `current_adapter': undefined method `[]' for #<File:/tmp/foo.json> (NoMethodError)
              from /opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/multi_json-1.13.1/lib/multi_json.rb:139:in `dump'
              from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/json.rb:70:in `dump'
              from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log/destinations.rb:112:in `handle'
              from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:191:in `block in newmessage'
              from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:190:in `each'
              from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:190:in `newmessage'
              from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:308:in `initialize'
              from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:88:in `new'
              from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:88:in `create'
              from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/logging.rb:11:in `send_log'
              from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/logging.rb:20:in `block (2 levels) in <module:Logging>'
              from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/logging.rb:69:in `log_exception'
              from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:673:in `rescue in exit_on_fail'
              from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:660:in `exit_on_fail'
              from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:366:in `run'
              from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:137:in `run'
              from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:73:in `execute'
              from /opt/puppetlabs/puppet/bin/puppet:5:in `<main>'
      

      Change the log destination to /tmp/foo.txt and it doesn't error.

      It looks like this bug was introduced in 5.5.0, 5.4.0 still works as expected, possibly related to PUP-8501.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            bodgit Matt Dainty
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support