Sha256: e943de3447cb4d68b5db5bb0cfa81883c8b5eb7d0777c74bc78482b6b821cf93

Contents?: true

Size: 789 Bytes

Versions: 2

Compression:

Stored size: 789 Bytes

Contents

require 'rundock'

module Rundock
  class Node
    attr_reader :name
    attr_reader :operations
    attr_reader :backend

    def initialize(name, backend)
      @name = name
      @backend = backend
      @operations = []
    end

    def add_operation(ope)
      @operations = [] unless @operations
      @operations << ope
    end

    def complete(scenario)
      @operations.each do |ope|
        ope.attributes[:nodeinfo].merge!(scenario.node_info)
      end
    end

    def run
      Logger.debug("run node: #{@name}")
      if @operations.blank?
        Logger.warn("no operation running: #{@name}")
        return
      end
      @operations.each do |ope|
        Logger.debug("run operation: #{ope.class}")
        ope.run(@backend, ope.attributes)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rundock-0.3.0 lib/rundock/node.rb
rundock-0.2.11 lib/rundock/node.rb