class NodeSpec::Node

Constants

WORKING_DIR

Attributes

communicator[R]
name[R]
os[R]

Public Class Methods

new(node_name, options = nil) click to toggle source
# File lib/nodespec/node.rb, line 10
def initialize(node_name, options = nil)
  @name = validate(node_name)
  opts = (options || {}).dup
  @os = opts.delete('os')
  adapter_name = opts.delete('adapter')
  @communicator = CommunicationAdapters.get_communicator(@name, adapter_name, opts)
end

Public Instance Methods

create_temp_directory(path) click to toggle source
# 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) click to toggle source
# File lib/nodespec/node.rb, line 35
def execute(command)
  backend_proxy.execute(command)
end

Private Instance Methods

backend_proxy() click to toggle source
# File lib/nodespec/node.rb, line 41
def backend_proxy
  @backend_proxy ||= @communicator.backend_proxy
end
validate(name) click to toggle source
# File lib/nodespec/node.rb, line 45
def validate(name)
  raise BadNodeNameError.new unless name =~ /^[a-zA-Z0-9][a-zA-Z0-9. \-_]+\s*$/
  name.strip.gsub(' ', '-')
end