Module: ForemanTasks

Extended by:
Algebrick::Matching, Algebrick::TypeCheck
Defined in:
app/controllers/foreman_tasks/api/tasks_controller.rb,
lib/foreman_tasks.rb,
lib/foreman_tasks/engine.rb,
lib/foreman_tasks/cleaner.rb,
lib/foreman_tasks/dynflow.rb,
lib/foreman_tasks/version.rb,
lib/foreman_tasks/triggers.rb,
lib/foreman_tasks/task_error.rb,
app/models/foreman_tasks/lock.rb,
app/models/foreman_tasks/task.rb,
lib/foreman_tasks/authorizer_ext.rb,
lib/foreman_tasks/dynflow/daemon.rb,
lib/foreman_tasks/test_extensions.rb,
app/models/foreman_tasks/task_group.rb,
app/models/foreman_tasks/triggering.rb,
lib/foreman_tasks/dynflow/persistence.rb,
app/helpers/foreman_tasks/tasks_helper.rb,
lib/foreman_tasks/dynflow/configuration.rb,
app/models/foreman_tasks/recurring_logic.rb,
app/models/foreman_tasks/task/summarizer.rb,
app/services/foreman_tasks/proxy_selector.rb,
app/models/foreman_tasks/task/dynflow_task.rb,
app/models/foreman_tasks/task_group_member.rb,
lib/foreman_tasks/dynflow/console_authorizer.rb,
app/controllers/foreman_tasks/tasks_controller.rb,
app/helpers/foreman_tasks/foreman_tasks_helper.rb,
app/models/foreman_tasks/task/status_explicator.rb,
app/models/foreman_tasks/concerns/action_subject.rb,
app/models/foreman_tasks/concerns/action_triggering.rb,
app/models/foreman_tasks/concerns/host_action_subject.rb,
app/models/foreman_tasks/task/task_cancelled_exception.rb,
app/controllers/foreman_tasks/recurring_logics_controller.rb,
app/controllers/foreman_tasks/concerns/parameters/triggering.rb,
app/controllers/foreman_tasks/api/recurring_logics_controller.rb,
app/controllers/foreman_tasks/concerns/environments_extension.rb,
app/models/foreman_tasks/concerns/architecture_action_subject.rb,
app/models/foreman_tasks/task_groups/recurring_logic_task_group.rb,
app/controllers/foreman_tasks/concerns/hosts_controller_extension.rb

Overview

Copyright 2013 Red Hat, Inc.

This software is licensed to you under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License (GPLv2) or (at your option) any later version. There is NO WARRANTY for this software, express or implied, including the implied warranties of MERCHANTABILITY, NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 along with this software; if not, see www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

Defined Under Namespace

Modules: Api, AuthorizerExt, Concerns, ForemanTasksHelper, TaskGroups, TasksHelper, TestExtensions, Triggers Classes: Cleaner, Dynflow, Engine, Lock, ProxySelector, RecurringLogic, RecurringLogicsController, Task, TaskError, TaskGroup, TaskGroupMember, TasksController, Triggering

Constant Summary collapse

VERSION =
"0.8.2"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.async_task(action, *args, &block) ⇒ Object



34
35
36
# File 'lib/foreman_tasks.rb', line 34

def self.async_task(action, *args, &block)
  trigger_task true, action, *args, &block
end

.delay(action, delay_options, *args) ⇒ Object



44
45
46
47
# File 'lib/foreman_tasks.rb', line 44

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

.dynflowObject



13
14
15
# File 'lib/foreman_tasks.rb', line 13

def self.dynflow
  @dynflow ||= ForemanTasks::Dynflow.new
end

.sync_task(action, *args, &block) ⇒ Object



38
39
40
41
42
# File 'lib/foreman_tasks.rb', line 38

def self.sync_task(action, *args, &block)
  trigger_task(false, action, *args, &block).tap do |task|
    raise TaskError.new(task) if task.execution_plan.error? || task.execution_plan.result == :warning
  end
end

.table_name_prefixObject



169
170
171
# File 'lib/foreman_tasks/engine.rb', line 169

def self.table_name_prefix
  "foreman_tasks_"
end

.trigger(action, *args, &block) ⇒ Object



17
18
19
# File 'lib/foreman_tasks.rb', line 17

def self.trigger(action, *args, &block)
  dynflow.world.trigger action, *args, &block
end

.trigger_task(async, action, *args, &block) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/foreman_tasks.rb', line 21

def self.trigger_task(async, action, *args, &block)
  Match! async, true, false

  match trigger(action, *args, &block),
        (on ::Dynflow::World::PlaningFailed.(error: ~any) do |error|
          raise error
        end),
        (on ::Dynflow::World::Triggered.(execution_plan_id: ~any, future: ~any) do |id, finished|
          finished.wait if async == false
          ForemanTasks::Task::DynflowTask.where(:external_id => id).first!
        end)
end

Instance Method Details

#use_relative_model_namingObject



173
174
175
# File 'lib/foreman_tasks/engine.rb', line 173

def use_relative_model_naming
  true
end