[Pkg-puppet-devel] Bug#1026354: puppet logger.rb expecting Exception, but getting String
Rob Burrowes
r.burrowes at auckland.ac.nz
Sun Dec 18 22:24:52 GMT 2022
Package: puppet-agent
Version: 7.20.0
Puppet is occasionally logging an exception in syslog
... /MSG: undefined method message for #String .../
/I tracked this done to calls to the log_exception(exception) method in
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/logging/logger.rb/
/log_exception(exception) is expecting an exception class, but when called from these two places, it is being passed a String, hence the error message
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/custom_facts/util/fact.rb
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/custom_facts/util/collection.rb/
/either //logger.rb should handle String arguments, or it shouldn't be being called with String arguments./
/A quick fix to logger.rb would be
/
def log_exception(exception)
if exception.respond_to?(:message)
msg = exception.message
msg += "\n" + exception.backtrace.join("\n") if Options[:trace]
else
msg = exception
end
error(msg, true)
end
//
Alternately, fact.rb and collection.rb could pass through the exception, or handle the backtrace themselves.
--
Rob Burrowes
Senior eResearch Platform and Services Engineer
Centre for eResearchhttps://wiki.auckland.ac.nz/display/CERES/Centre+for+eResearch
Building 302, Room 590 Ph: +64 9 923 2308 (Internal 82308)
23 Symonds Street Cell: +64 27 4731856 (internal 64209)
The University of Aucklandhttps://www.linkedin.com/in/rob-burrowes-7a5a8a56
Private Bag 92019http://www.burrowes.org/
Auckland Mail Centrehttp://www.wikarekare.org/
Auckland 1142 orcid.org/0000-0002-8647-6012
NEW ZEALAND
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-puppet-devel/attachments/20221219/f9d84524/attachment.htm>
More information about the Pkg-puppet-devel
mailing list