Class: TestLab::Node
- Inherits:
-
ZTK::DSL::Base
- Object
- ZTK::DSL::Base
- TestLab::Node
- Extended by:
- ClassMethods
- Includes:
- Actions, Doctor, LXC, MethodMissing, Provision, SSH, Status, Support::Execution, Support::Lifecycle, Utility::Misc
- Defined in:
- lib/testlab/node.rb,
lib/testlab/node/lxc.rb,
lib/testlab/node/ssh.rb,
lib/testlab/node/doctor.rb,
lib/testlab/node/status.rb,
lib/testlab/node/actions.rb,
lib/testlab/node/provision.rb,
lib/testlab/node/class_methods.rb,
lib/testlab/node/method_missing.rb
Overview
Node Class
Defined Under Namespace
Modules: Actions, ClassMethods, Doctor, LXC, MethodMissing, Provision, SSH, Status
Constant Summary collapse
- STATUS_KEYS =
%w(id instance_id ok state user ip port provider provisioners).map(&:to_sym)
Class Method Summary collapse
Instance Method Summary collapse
- #config_dir ⇒ Object
- #domain ⇒ Object
-
#initialize(*args) ⇒ Node
constructor
A new instance of Node.
- #repo_dir ⇒ Object
Methods included from ClassMethods
Methods included from Utility::Misc
#do_provisioner_callbacks, #format_message, #format_object_action, #please_wait, #sudo, #sudo_prompt
Methods included from Support::Lifecycle
#bounce, #build, #demolish, #recycle
Methods included from Support::Execution
#bootstrap, #download, #exec, #file, #upload
Methods included from Status
Methods included from SSH
#container_ssh, #ssh, #ssh_shutdown!
Methods included from Provision
Methods included from MethodMissing
Methods included from LXC
Methods included from Doctor
Methods included from Actions
Constructor Details
#initialize(*args) ⇒ Node
Returns a new instance of Node.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/testlab/node.rb', line 54 def initialize(*args) @ui = TestLab.ui @ui.logger.debug { "Loading Node" } super(*args) self.config.merge!(:node => { :id => self.id.dup }) @provider = self.provider.new(self.config, @ui) raise NodeError, "You must specify a provider class!" if self.provider.nil? @ui.logger.debug { "Node '#{self.id}' Loaded" } end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class TestLab::Node::MethodMissing
Class Method Details
.by_priority(priority) ⇒ Object
89 90 91 |
# File 'lib/testlab/node.rb', line 89 def by_priority(priority) self.all.select{ |n| n.priority == priority } end |
.priority_groups ⇒ Object
85 86 87 |
# File 'lib/testlab/node.rb', line 85 def priority_groups self.all.map(&:priority).sort.uniq.reverse end |
Instance Method Details
#config_dir ⇒ Object
70 71 72 |
# File 'lib/testlab/node.rb', line 70 def config_dir self.labfile.config_dir end |
#domain ⇒ Object
78 79 80 81 |
# File 'lib/testlab/node.rb', line 78 def domain self.config[:bind] ||= Hash.new self.config[:bind][:domain] ||= 'tld.invalid' end |
#repo_dir ⇒ Object
74 75 76 |
# File 'lib/testlab/node.rb', line 74 def repo_dir self.labfile.repo_dir end |