Class: Cabal::SSH
- Inherits:
-
Object
- Object
- Cabal::SSH
- Defined in:
- lib/cabal/ssh.rb
Overview
Generates SSH sessions for remote server interaction
Class Method Summary collapse
-
.connect(options = {}) ⇒ nil
Create a new instance and use it to generate an SSH session.
Instance Method Summary collapse
-
#connect ⇒ nil
Initiate an SSH connection in the current terminal.
-
#initialize(cluster, ssh_signature, client, identity_timeout, kernel) ⇒ SSH
constructor
A new instance of SSH.
-
#lifetime ⇒ String
The lifetime option that would be passed to ssh-add for this session.
Constructor Details
#initialize(cluster, ssh_signature, client, identity_timeout, kernel) ⇒ SSH
Returns a new instance of SSH.
35 36 37 38 39 40 41 |
# File 'lib/cabal/ssh.rb', line 35 def initialize(cluster, ssh_signature, client, identity_timeout, kernel) @cluster = cluster @ssh_signature = ssh_signature @client = client @identity_timeout = identity_timeout @kernel = kernel end |
Class Method Details
.connect(options = {}) ⇒ nil
Create a new instance and use it to generate an SSH session
25 26 27 28 29 30 31 32 33 |
# File 'lib/cabal/ssh.rb', line 25 def self.connect( = {}) new( [:cluster], [:ssh_signature], [:client], [:identity_timeout] || 1800, [:kernel] || Kernel ).connect end |
Instance Method Details
#connect ⇒ nil
Initiate an SSH connection in the current terminal
53 54 55 56 57 58 59 60 |
# File 'lib/cabal/ssh.rb', line 53 def connect begin write_private_key initiate_connection ensure terminate_connection end end |
#lifetime ⇒ String
The lifetime option that would be passed to ssh-add for this session
46 47 48 49 |
# File 'lib/cabal/ssh.rb', line 46 def lifetime return '' if identity_timeout == 0 "-t #{identity_timeout}" end |