app/lib/actions/proxy_action.rb in foreman-tasks-0.14.6 vs app/lib/actions/proxy_action.rb in foreman-tasks-0.15.0
- old
+ new
@@ -6,14 +6,15 @@
execution_plan_hooks.use :clean_remote_task, :on => :stopped
execution_plan_hooks.use :wipe_secrets!, :on => :stopped
class CallbackData
- attr_reader :data
+ attr_reader :data, :meta
- def initialize(data)
+ def initialize(data, meta = {})
@data = data
+ @meta = meta
end
end
class ProxyActionMissing < RuntimeError
def backtrace
@@ -44,11 +45,11 @@
when ::Dynflow::Action::Cancellable::Cancel
cancel_proxy_task
when ::Dynflow::Action::Cancellable::Abort
abort_proxy_task
when CallbackData
- on_data(event.data)
+ on_data(event.data, event.meta)
when ProxyActionMissing
on_proxy_action_missing
when ProxyActionStopped
on_proxy_action_stopped
else
@@ -104,10 +105,11 @@
# TODO: add logic to load the data from the external action
suspend
end
# @override to put custom logic on event handling
- def on_data(data)
+ def on_data(data, meta = {})
+ action_logger.info(_('Event delivered by request %{request_id}') % { :request_id => meta[:request_id] }) if meta[:request_id].present?
output[:proxy_output] = data
end
# Removes the :secrets key from the action's input and output and saves the action
def wipe_secrets!(_execution_plan)