Class: Skewer::ErsatzNode

Inherits:
Object
  • Object
show all
Defined in:
lib/ersatz/ersatz_node.rb

Overview

fakes a fog node

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hostname, user) ⇒ ErsatzNode

Returns a new instance of ErsatzNode.



8
9
10
11
# File 'lib/ersatz/ersatz_node.rb', line 8

def initialize(hostname, user)
  @dns_name = hostname
  @username = user
end

Instance Attribute Details

#dns_nameObject

Returns the value of attribute dns_name.



6
7
8
# File 'lib/ersatz/ersatz_node.rb', line 6

def dns_name
  @dns_name
end

#usernameObject

Returns the value of attribute username.



6
7
8
# File 'lib/ersatz/ersatz_node.rb', line 6

def username
  @username
end

Instance Method Details

#destroyObject



25
26
# File 'lib/ersatz/ersatz_node.rb', line 25

def destroy
end

#scp(file, dest) ⇒ Object



21
22
23
# File 'lib/ersatz/ersatz_node.rb', line 21

def scp(file, dest)
  `scp #{file} #{@username}@#{@dns_name}:#{dest}`
end

#ssh(command) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/ersatz/ersatz_node.rb', line 13

def ssh(command)
  full_ssh_command = "ssh -l #{@username} #{@dns_name} '#{command}'"
  Skewer.logger.debug full_ssh_command
  stdout = `#{full_ssh_command}`
  result = ErsatzSSHResult.new(command, stdout, $?.exitstatus)
  [result]
end

#wait_forObject



28
29
# File 'lib/ersatz/ersatz_node.rb', line 28

def wait_for
end