8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/legion/extensions/ssh/helpers/connection.rb', line 8
def session(server:, user: 'root', **opts)
hash = {}
if opts.key? :password
hash[:password] = opts[:password]
elsif opts.key? :key_data
hash[:key_data] = opts[:key_data]
elsif opts.key? :keys
hash[:keys] = opts[:keys]
end
hash[:non_interactive] = opts.key?(:non_interactive) ? opts[:non_interactive] : true
hash[:passphrase] = opts[:passphrase] if opts.key? :passphrase
hash[:timeout] = opts.key(:timeout) ? opts[:timeout] : 5
Net::SSH.start(server, user, **hash)
end
|