Module: Actions::RemoteExecution::EventHelpers

Included in:
RunHostJob, RunHostsJob
Defined in:
app/lib/actions/remote_execution/event_helpers.rb

Defined Under Namespace

Modules: ClassEventHelpers

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



22
23
24
# File 'app/lib/actions/remote_execution/event_helpers.rb', line 22

def self.included(base)
  base.extend ClassEventHelpers
end

Instance Method Details

#emit_event(execution_plan, hook) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/lib/actions/remote_execution/event_helpers.rb', line 26

def emit_event(execution_plan, hook)
  return unless root_action?

  payload = event_payload(execution_plan)
  base = self.class.event_name_base
  suffix = self.class.event_name_suffix(hook)
  if input["job_features"]&.any?
    input['job_features'].each do |feature|
      name = "#{base}_#{feature}_#{suffix}"
      trigger_hook name, payload: payload
    end
  end
  trigger_hook("#{base}_#{suffix}", payload: payload)
end