Class: LinuxAdmin::SSH

Inherits:
Object
  • Object
show all
Defined in:
lib/linux_admin/ssh.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ip, username, private_key = nil, password = nil) ⇒ SSH

Returns a new instance of SSH.



8
9
10
11
12
13
# File 'lib/linux_admin/ssh.rb', line 8

def initialize(ip, username, private_key = nil, password = nil)
  @ip = ip
  @private_key = private_key
  @username = username
  @password = password
end

Instance Attribute Details

#agentObject (readonly)

Returns the value of attribute agent.



6
7
8
# File 'lib/linux_admin/ssh.rb', line 6

def agent
  @agent
end

#ipObject (readonly)

Returns the value of attribute ip.



3
4
5
# File 'lib/linux_admin/ssh.rb', line 3

def ip
  @ip
end

#private_keyObject (readonly)

Returns the value of attribute private_key.



5
6
7
# File 'lib/linux_admin/ssh.rb', line 5

def private_key
  @private_key
end

#usernameObject (readonly)

Returns the value of attribute username.



4
5
6
# File 'lib/linux_admin/ssh.rb', line 4

def username
  @username
end

Instance Method Details

#perform_commands(commands = [], agent_socket = nil, stdin = nil) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/linux_admin/ssh.rb', line 15

def perform_commands(commands = [], agent_socket = nil, stdin = nil)
  require 'net/ssh'
  if block_given?
    execute_commands(commands, agent_socket, stdin, &Proc.new)
  else
    execute_commands(commands, agent_socket, stdin)
  end
end