Class: Nagios::Host

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/infrastructure/host_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hostname) ⇒ Host

Returns a new instance of Host.



30
31
32
33
34
35
# File 'lib/rspec/infrastructure/host_manager.rb', line 30

def initialize(hostname)
  @hostname = hostname
  @user = 'deploy'
  @keys = [ '/Users/james/.ssh/id_rsa' ]
  @ssh = Net::SSH::Simple.new
end

Instance Attribute Details

#hostnameObject (readonly)

Returns the value of attribute hostname.



28
29
30
# File 'lib/rspec/infrastructure/host_manager.rb', line 28

def hostname
  @hostname
end

#sshObject (readonly)

Returns the value of attribute ssh.



28
29
30
# File 'lib/rspec/infrastructure/host_manager.rb', line 28

def ssh
  @ssh
end

Instance Method Details

#exec(command) ⇒ Object



37
38
39
# File 'lib/rspec/infrastructure/host_manager.rb', line 37

def exec(command)
  Hashie::Mash.new(@ssh.ssh(hostname, command, { :user => @user, :keys => @keys, :timeout => 300 }))
end