Class: SshForever::SecureShellForever
- Inherits:
-
Object
- Object
- SshForever::SecureShellForever
- Defined in:
- lib/cuken/api/ssh-forever.rb
Instance Method Summary collapse
- #initialization_run ⇒ Object
-
#initialize(login, options = {}) ⇒ SecureShellForever
constructor
A new instance of SecureShellForever.
- #run_interactive ⇒ Object
Constructor Details
#initialize(login, options = {}) ⇒ SecureShellForever
Returns a new instance of SecureShellForever.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/cuken/api/ssh-forever.rb', line 8 def initialize(login, = {}) @login = login @options = @username, @hostname = @login.split("@") cleanup_ssh_config cleanup_identity_files local_config_path initialization_run local_key_path end |
Instance Method Details
#initialization_run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cuken/api/ssh-forever.rb', line 19 def initialization_run unless File.exists?(config_file_path) puts "You do not appear to have a config file. Expected one at #{config_file_path}" unless @options[:quiet] existing_ssh_config? ? append_ssh_config : write_ssh_config puts "Next: check for a public key." unless @options[:quiet] unless File.exists?(public_key_path) puts "You do not appear to have an identity file/public key. Expected one at #{public_key_path}" unless @options[:quiet] confirm_keygen generate_public_key end end args = ssh_args() copy_public_key(args) puts "Success. From now on you can just use plain old 'ssh'. Logging you in..." unless @options[:quiet] status = run_shell_cmd(ssh_login(args)) #cleanup_ssh_config # exitstatus 2 is when ssh-add can't find an agent on local machine. # We ought to switch to use Net::SSH libraries.... exit 1 unless status.exitstatus.to_i == 0 || status.exitstatus.to_i == 2 end |
#run_interactive ⇒ Object
42 43 44 45 |
# File 'lib/cuken/api/ssh-forever.rb', line 42 def run_interactive system ssh_login_interactive(ssh_args) #cleanup_ssh_config end |