Method: Nodectl::Recipe#run_trigger

Defined in:
lib/nodectl/recipe.rb

#run_trigger(service, action_name, trigger_type) ⇒ Object



76
77
78
79
80
81
82
83
# File 'lib/nodectl/recipe.rb', line 76

def run_trigger(service, action_name, trigger_type)
  unless [:pre, :post].include? trigger_type
    raise "incorrect trigger type: expected 'post' or 'pre'"
  end

  trigger = @triggers[:"#{trigger_type}_#{action_name}"]
  context(service).instance_eval &trigger if trigger
end