Class: ObsDeploy::SSH
- Inherits:
-
Object
- Object
- ObsDeploy::SSH
- Defined in:
- lib/obs_deploy/ssh.rb
Instance Attribute Summary collapse
-
#identity_file ⇒ Object
readonly
Returns the value of attribute identity_file.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #build_command ⇒ Object
-
#initialize(opts = {}) ⇒ SSH
constructor
A new instance of SSH.
- #run(cmd) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ SSH
Returns a new instance of SSH.
7 8 9 10 11 12 13 |
# File 'lib/obs_deploy/ssh.rb', line 7 def initialize(opts = {}) @user = opts[:user] || 'root' @server = opts[:server] || 'localhost' @port = opts[:port] || 22 @identity_file = opts[:identity_file] @debug = opts[:debug] || false end |
Instance Attribute Details
#identity_file ⇒ Object (readonly)
Returns the value of attribute identity_file.
5 6 7 |
# File 'lib/obs_deploy/ssh.rb', line 5 def identity_file @identity_file end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
5 6 7 |
# File 'lib/obs_deploy/ssh.rb', line 5 def port @port end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
5 6 7 |
# File 'lib/obs_deploy/ssh.rb', line 5 def server @server end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
5 6 7 |
# File 'lib/obs_deploy/ssh.rb', line 5 def user @user end |
Instance Method Details
#build_command ⇒ Object
15 16 17 |
# File 'lib/obs_deploy/ssh.rb', line 15 def build_command ['ssh'] + basic_connection_string + identity + ssh_port end |
#run(cmd) ⇒ Object
19 20 21 |
# File 'lib/obs_deploy/ssh.rb', line 19 def run(cmd) Cheetah.run(build_command + cmd, logger: logger) end |