Method: MCollective::Util::Playbook::Tasks#load_tasks

Defined in:
lib/mcollective/util/playbook/tasks.rb

#load_tasks(data, set) ⇒ Object



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/mcollective/util/playbook/tasks.rb', line 151

def load_tasks(data, set)
  data.each_with_index do |task, idx|
    task.each do |type, props|
      Log.debug("Loading task %d of type %s into %s" % [idx, type, set])

      runner = runner_for(type)
      runner.description = props.fetch("description", "%s task" % [type])

      task_data = {
        :description => runner.description,
        :type => type,
        :runner => runner,
        :properties => {
          "tries" => 1,
          "try_sleep" => 10,
          "fail_ok" => false
        }.merge(props)
      }

      runner.fail_ok = task_data[:properties]["fail_ok"]

      task_data[:result] = TaskResult.new(task_data)

      @tasks[set] << task_data
    end
  end

  @tasks[set]
end