Sha256: 8562aee0d4f2d5a6042cce06e686d37ccd6a8a7e0d73e6bbc30c1b1f8bc5b283

Contents?: true

Size: 1.51 KB

Versions: 9

Compression:

Stored size: 1.51 KB

Contents

class TestLab

  # Node Error Class
  class NodeError < TestLabError; end

  # Node Class
  #
  # @author Zachary Patten <zachary AT jovelabs DOT com>
  class Node < ZTK::DSL::Base
    STATUS_KEYS   = %w(id instance_id state user ip port provider provisioners).map(&:to_sym)

    # Sub-Modules
    autoload :Actions,       'testlab/node/actions'
    autoload :ClassMethods,  'testlab/node/class_methods'
    autoload :Lifecycle,     'testlab/node/lifecycle'
    autoload :LXC,           'testlab/node/lxc'
    autoload :MethodMissing, 'testlab/node/method_missing'
    autoload :SSH,           'testlab/node/ssh'
    autoload :Status,        'testlab/node/status'

    include TestLab::Node::Actions
    include TestLab::Node::Lifecycle
    include TestLab::Node::LXC
    include TestLab::Node::MethodMissing
    include TestLab::Node::SSH
    include TestLab::Node::Status

    extend  TestLab::Node::ClassMethods

    include TestLab::Utility::Misc

    # Associations and Attributes
    belongs_to :labfile,       :class_name => 'TestLab::Labfile'

    has_many   :containers,    :class_name => 'TestLab::Container'
    has_many   :networks,      :class_name => 'TestLab::Network'

    attribute  :provider
    attribute  :provisioners,  :default => Array.new
    attribute  :config,        :default => Hash.new


    def initialize(*args)
      super(*args)

      raise NodeError, "You must specify a provider class!" if self.provider.nil?

      @ui       = TestLab.ui
      @provider = self.provider.new(self.config, @ui)
    end

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
testlab-0.6.15 lib/testlab/node.rb
testlab-0.6.14 lib/testlab/node.rb
testlab-0.6.12 lib/testlab/node.rb
testlab-0.6.11 lib/testlab/node.rb
testlab-0.6.10 lib/testlab/node.rb
testlab-0.6.9 lib/testlab/node.rb
testlab-0.6.8 lib/testlab/node.rb
testlab-0.6.7 lib/testlab/node.rb
testlab-0.6.6 lib/testlab/node.rb