app/lib/actions/observable_action.rb in foreman-tasks-8.2.1 vs app/lib/actions/observable_action.rb in foreman-tasks-8.3.0

- old
+ new

@@ -34,11 +34,11 @@ hook end end def event_names - [event_name_base + '_' + event_name_suffix(:success)] + [:success, :failure].map { |suffix| event_name_base + '_' + event_name_suffix(suffix) } end def namespaced_event_names event_names.map { |e| ::Foreman::Observable.event_name_for(e) } end @@ -49,10 +49,19 @@ end def self.included(base) base.extend ClassMethods base.include ::Foreman::Observable - base.execution_plan_hooks.use :emit_event, :on => :success + base.execution_plan_hooks.use :emit_event_success, :on => :success + base.execution_plan_hooks.use :emit_event_failure, :on => :failure + end + + def emit_event_success(execution_plan) + emit_event(execution_plan, :success) + end + + def emit_event_failure(execution_plan) + emit_event(execution_plan, :failure) end def emit_event(execution_plan, hook = :success) return unless root_action?