Class: Nagios::Host
- Inherits:
-
Object
- Object
- Nagios::Host
- Defined in:
- lib/rspec/infrastructure/host_manager.rb
Instance Attribute Summary collapse
-
#hostname ⇒ Object
readonly
Returns the value of attribute hostname.
-
#ssh ⇒ Object
readonly
Returns the value of attribute ssh.
Instance Method Summary collapse
- #exec(command) ⇒ Object
-
#initialize(hostname) ⇒ Host
constructor
A new instance of Host.
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
#hostname ⇒ Object (readonly)
Returns the value of attribute hostname.
28 29 30 |
# File 'lib/rspec/infrastructure/host_manager.rb', line 28 def hostname @hostname end |
#ssh ⇒ Object (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 |