module ForemanTasks
Constants
- VERSION
Public Class Methods
async_task(action, *args, &block)
click to toggle source
# File lib/foreman_tasks.rb, line 42 def self.async_task(action, *args, &block) trigger_task true, action, *args, &block end
delay(action, delay_options, *args)
click to toggle source
# File lib/foreman_tasks.rb, line 52 def self.delay(action, delay_options, *args) result = dynflow.world.delay action, delay_options, *args ForemanTasks::Task::DynflowTask.where(:external_id => result.id).first! end
dynflow()
click to toggle source
# File lib/foreman_tasks.rb, line 14 def self.dynflow @dynflow ||= ForemanTasks::Dynflow.new(nil, ForemanTasks::Dynflow::Configuration.new) end
rails_safe_trigger_task() { || ... }
click to toggle source
# File lib/foreman_tasks.rb, line 36 def self.rails_safe_trigger_task ActiveSupport::Dependencies.interlock.permit_concurrent_loads do yield end end
sync_task(action, *args, &block)
click to toggle source
# File lib/foreman_tasks.rb, line 46 def self.sync_task(action, *args, &block) trigger_task(false, action, *args, &block).tap do |task| raise TaskError, task if task.execution_plan.error? || task.execution_plan.result == :warning end end
table_name_prefix()
click to toggle source
# File lib/foreman_tasks/engine.rb, line 155 def self.table_name_prefix 'foreman_tasks_' end
trigger(action, *args, &block)
click to toggle source
# File lib/foreman_tasks.rb, line 18 def self.trigger(action, *args, &block) dynflow.world.trigger action, *args, &block end
trigger_task(async, action, *args, &block)
click to toggle source
# File lib/foreman_tasks.rb, line 22 def self.trigger_task(async, action, *args, &block) rails_safe_trigger_task do Match! async, true, false match trigger(action, *args, &block), (on ::Dynflow::World::PlaningFailed.call(error: ~any) do |error| raise error end), (on ::Dynflow::World::Triggered.call(execution_plan_id: ~any, future: ~any) do |id, finished| finished.wait if async == false ForemanTasks::Task::DynflowTask.where(:external_id => id).first! end) end end
Public Instance Methods
use_relative_model_naming()
click to toggle source
# File lib/foreman_tasks/engine.rb, line 159 def use_relative_model_naming true end