Class: LinuxAdmin::SSH
- Inherits:
-
Object
- Object
- LinuxAdmin::SSH
- Defined in:
- lib/linux_admin/ssh.rb
Instance Attribute Summary collapse
-
#agent ⇒ Object
readonly
Returns the value of attribute agent.
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
-
#private_key ⇒ Object
readonly
Returns the value of attribute private_key.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(ip, username, private_key = nil, password = nil) ⇒ SSH
constructor
A new instance of SSH.
- #perform_commands(commands = [], agent_socket = nil, stdin = nil) ⇒ Object
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
#agent ⇒ Object (readonly)
Returns the value of attribute agent.
6 7 8 |
# File 'lib/linux_admin/ssh.rb', line 6 def agent @agent end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
3 4 5 |
# File 'lib/linux_admin/ssh.rb', line 3 def ip @ip end |
#private_key ⇒ Object (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 |
#username ⇒ Object (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 |