Sha256: 6d8031155fa3858c8b0ded33391b81f894f60f6a6e5146786fbbfc2d5ea981bf
Contents?: true
Size: 1.26 KB
Versions: 2
Compression:
Stored size: 1.26 KB
Contents
module Actions module ForemanPatch module Invocation module ProcessLogging def invocation @invocation ||= ::ForemanPatch::Invocation.find_by(task_id: task.id) end def log_invocation_event(event, type = 'debug', timestamp = Time.zone.now) last = invocation.events.order(:sequence).last sequence = last ? last.sequence + 1 : 0 invocation.events.create!( event_type: type, event: event, timestamp: timestamp, sequence: sequence ) end def log_invocation_exception(exception) last = invocation.events.order(:sequence).last sequence = last ? last.sequence + 1 : 0 invocation.events.create!( event_type: 'debug', event: "#{exception.class}: #{exception.message}", timestamp: Time.zone.now, sequence: sequence ) end def with_invocation_error_logging unless catch(::Dynflow::Action::ERROR) { yield || true } log_invocation_exception(error.exception) throw ::Dynflow::Action::ERROR end rescue => e log_invocation_exception(e) raise e end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
foreman_patch-1.1.6.alpha5 | app/lib/actions/foreman_patch/invocation/process_logging.rb |
foreman_patch-1.1.6.alpha4 | app/lib/actions/foreman_patch/invocation/process_logging.rb |