Class: Toolshed::Commands::SSH
- Inherits:
-
Object
- Object
- Toolshed::Commands::SSH
- Defined in:
- lib/toolshed/commands/ssh.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.cli_options ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/toolshed/commands/ssh.rb', line 6 def self. { banner: 'Usage: ssh [options]', options: { use_sudo: { short_on: '-e' }, host: { short_on: '-o' }, connection_string_options: { short_on: '-n' }, commands: { short_on: '-c' }, password: { short_on: '-p' }, prompt_for_password: { short_on: '-r' }, user: { short_on: '-u' }, keys: { short_on: '-k' }, sudo_password: { short_on: '-s' }, verbose_output: { short_on: '-v' }, timeout_period: { short_on: '-t' } } } end |
Instance Method Details
#execute(args, options = {}) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/toolshed/commands/ssh.rb', line 47 def execute(args, = {}) Toolshed.logger.info "Running ssh command with options #{.inspect}" unless [:verbose_output].nil? || [:verbose_output].empty? # rubocop:disable Metrics/LineLength begin ssh = Toolshed::ServerAdministration::SSH.new() ssh.execute rescue => e Toolshed.logger.fatal e. Toolshed.logger.fatal "Unable to connect to #{[:host]}" Toolshed.die end end |