Sha256: 5e7a876e5ceeb18671cf2264dfc370d63c53b5fe01ede9e262f9ac715c85c16c

Contents?: true

Size: 817 Bytes

Versions: 6

Compression:

Stored size: 817 Bytes

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
          attributes[:task_args] = task_set.slice(1..-1) if task_set.length > 1
          unless attributes[:task_info].key?(task_name.to_sym)
            Logger.warn("task not found and ignored: #{task_name}")
            next
          end

          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

6 entries across 6 versions & 1 rubygems

Version Path
rundock-1.1.1 lib/rundock/operation/task.rb
rundock-1.1.0 lib/rundock/operation/task.rb
rundock-1.0.8 lib/rundock/operation/task.rb
rundock-1.0.7 lib/rundock/operation/task.rb
rundock-1.0.6 lib/rundock/operation/task.rb
rundock-1.0.5 lib/rundock/operation/task.rb