Class: ForemanHooks::OrchestrationHook::HookRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/foreman_hooks/orchestration_hook.rb

Overview

Orchestration runs methods against an object, so generate a runner for each hook that will need executing

Instance Method Summary collapse

Constructor Details

#initialize(filename, obj, event) ⇒ HookRunner

Returns a new instance of HookRunner.



47
48
49
50
51
# File 'lib/foreman_hooks/orchestration_hook.rb', line 47

def initialize(filename, obj, event)
  @filename = filename
  @obj = obj
  @event = event
end

Instance Method Details

#argsObject



53
54
55
# File 'lib/foreman_hooks/orchestration_hook.rb', line 53

def args
  [@obj.to_s]
end

#hook_execute_delObject



61
62
63
# File 'lib/foreman_hooks/orchestration_hook.rb', line 61

def hook_execute_del
  @obj.exec_hook(@filename, 'destroy', *args)
end

#hook_execute_setObject



57
58
59
# File 'lib/foreman_hooks/orchestration_hook.rb', line 57

def hook_execute_set
  @obj.exec_hook(@filename, @event, *args)
end