Class: NodeSpec::Node
- Inherits:
-
Object
- Object
- NodeSpec::Node
- Defined in:
- lib/nodespec/node.rb
Defined Under Namespace
Classes: BadNodeNameError
Constant Summary collapse
- WORKING_DIR =
'.nodespec'
Instance Attribute Summary collapse
-
#communicator ⇒ Object
readonly
Returns the value of attribute communicator.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#os ⇒ Object
readonly
Returns the value of attribute os.
Instance Method Summary collapse
- #create_temp_directory(path) ⇒ Object
- #execute(command) ⇒ Object
-
#initialize(node_name, options = nil) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(node_name, options = nil) ⇒ Node
Returns a new instance of Node.
10 11 12 13 14 15 16 |
# File 'lib/nodespec/node.rb', line 10 def initialize(node_name, = nil) @name = validate(node_name) opts = ( || {}).dup @os = opts.delete('os') adapter_name = opts.delete('adapter') @communicator = CommunicationAdapters.get_communicator(@name, adapter_name, opts) end |
Instance Attribute Details
#communicator ⇒ Object (readonly)
Returns the value of attribute communicator.
8 9 10 |
# File 'lib/nodespec/node.rb', line 8 def communicator @communicator end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/nodespec/node.rb', line 8 def name @name end |
#os ⇒ Object (readonly)
Returns the value of attribute os.
8 9 10 |
# File 'lib/nodespec/node.rb', line 8 def os @os end |
Instance Method Details
#create_temp_directory(path) ⇒ Object
30 31 32 33 |
# File 'lib/nodespec/node.rb', line 30 def create_temp_directory(path) path = path[1..-1] if path.start_with?('/') create_directory("#{backend_proxy.temp_directory}/#{path}") end |
#execute(command) ⇒ Object
35 36 37 |
# File 'lib/nodespec/node.rb', line 35 def execute(command) backend_proxy.execute(command) end |