Class: ObsDeploy::SSH

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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_fileObject (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

#portObject (readonly)

Returns the value of attribute port.



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

def port
  @port
end

#serverObject (readonly)

Returns the value of attribute server.



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

def server
  @server
end

#userObject (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_commandObject



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