Fix SSH interactive mode

Fabric is broken, use os.execvp like it was before.

Change-Id: I59759618d3cbba907c931ddcf88cbb21045e4b4d
This commit is contained in:
Przemyslaw Kaminski 2015-05-15 09:58:21 +02:00
parent a307312bef
commit 4a24d5d783
2 changed files with 28 additions and 4 deletions

View File

@ -39,6 +39,7 @@ from fuel_dev_tools import ssh
COMMANDS = {
'info': info.Info,
'send-identity': ssh.SendIdentity,
'ssh': ssh.SSH,
'astute-id': astute.Id,

View File

@ -12,10 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
import six
import subprocess
import fabric
from fabric import context_managers
from fabric import api as fabric_api
from fuel_dev_tools import command
@ -99,14 +101,35 @@ class SSHMixin(object):
def ssh_command_interactive(self, *args):
self.print_debug("COMMAND: %r" % list(args))
command = None
# NOTE: fabric's open_shell is broken: it's TERM or something like
# that that breaks arrow keys for browsing history in Bash, etc.
#command = None
#if args:
#command = ' '.join(args)
#self.print_debug('interactive %s' % command)
#fabric_api.open_shell(command=command)
commands = [
'ssh', '-t',
'{}@{}'.format(self.app_args.user, self.app_args.ip),
'-p', self.app_args.port,
'-i', self.app_args.identity_file,
]
if args:
command = ' '.join(args)
commands.append('-C')
commands.extend(list(args))
self.print_debug('interactive %s' % command)
os.execvp('ssh', commands)
fabric_api.open_shell(command=command)
class SendIdentity(SSHMixin, command.BaseCommand):
def take_action(self, parsed_args):
self.send_identity()
class SSH(SSHMixin, command.BaseCommand):