lib/aptible/cli/subcommands/ssh.rb in aptible-cli-0.4.1 vs lib/aptible/cli/subcommands/ssh.rb in aptible-cli-0.4.2
- old
+ new
@@ -2,11 +2,10 @@
module Aptible
module CLI
module Subcommands
module SSH
- # rubocop:disable MethodLength
def self.included(thor)
thor.class_eval do
include Helpers::Operation
include Helpers::App
@@ -15,31 +14,32 @@
Runs an interactive command against a remote Aptible app
If specifying an app, invoke via: aptible ssh [--app=APP] COMMAND
LONGDESC
option :app
+ option :force_tty, type: :boolean
def ssh(*args)
app = ensure_app(options)
host = app.account.bastion_host
port = app.account.bastion_port
ENV['ACCESS_TOKEN'] = fetch_token
ENV['APTIBLE_COMMAND'] = command_from_args(*args)
ENV['APTIBLE_APP'] = app.handle
- opts = " -o 'SendEnv=*' -o StrictHostKeyChecking=no " \
- '-o UserKnownHostsFile=/dev/null'
+ opts = options[:force_tty] ? '-t -t' : ''
+ opts << " -o 'SendEnv=*' -o StrictHostKeyChecking=no " \
+ '-o UserKnownHostsFile=/dev/null'
Kernel.exec "ssh #{opts} -p #{port} root@#{host}"
end
private
def command_from_args(*args)
args.empty? ? '/bin/bash' : Shellwords.join(args)
end
end
end
- # rubocop:enable MethodLength
end
end
end
end