class Hpe3parSdk::SSH
Attributes
conn_timeout[RW]
http_log_debug[RW]
ip[RW]
logger[RW]
password[RW]
port[RW]
privatekey[RW]
username[RW]
Public Class Methods
new(ip, username, password, port=nil, conn_timeout=nil, privatekey=nil)
click to toggle source
# File lib/Hpe3parSdk/ssh.rb, line 22 def initialize(ip, username, password, port=nil, conn_timeout=nil, privatekey=nil) @ip = ip @username = username @password = password @port = port @conn_timeout = conn_timeout @privatekey = privatekey @http_log_debug = http_log_debug end
Public Instance Methods
run(command)
click to toggle source
# File lib/Hpe3parSdk/ssh.rb, line 32 def run(command) begin ssh = Net::SSH.start(@ip, @username, :password => @password) cmd = "#{command} -csvtable -nohdtot" Hpe3parSdk.logger.debug("Sending SSH command [#{cmd}]") stdout, stederr = ssh.exec!(cmd) ssh.close() stdout rescue Hpe3parSdk::HPE3PARException => ex Hpe3parSdk.logger.error("(#{__method__}) #{ex.message}") end end