Sha256: c58903335dc85c3a376e204fe0368f228ab87bc51dbb691bfe7062b8fa31d6ce

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

module Rundock
  module Operation
    class Task < Base
      def run(backend, attributes = {})
        @instruction.each do |i|
          task_set = i.split(' ')
          task_name = task_set.first

          if task_set.length > 1
            attributes[:task_args] = task_set.slice(1..-1).map do |arg|
              assign_args(arg, attributes[:parrent_task_args])
            end
          end

          unless attributes[:task_info].key?(task_name.to_sym)
            Logger.warn("task not found and ignored: #{task_name}")
            next
          end

          next if !attributes[:filtered_tasks].nil? && !attributes[:filtered_tasks].include?(task_name)

          scenario = Rundock::Builder::ScenarioBuilder.new(nil, nil).build_task(
            attributes[:task_info][task_name.to_sym], backend, Rundock::Attribute::NodeAttribute.new(attributes)
          )

          logging(i, 'info')
          Logger.formatter.rec_lock

          scenario.run
          Logger.formatter.rec_unlock
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rundock-1.2.1 lib/rundock/operation/task.rb
rundock-1.2.0 lib/rundock/operation/task.rb
rundock-1.1.7 lib/rundock/operation/task.rb
rundock-1.1.6 lib/rundock/operation/task.rb