Merge pull request #87 from aceat64/bugfix/mosh

Mosh doesn't support "-l" for user, only user@host for args
nistp521
Roman Zeyde 8 years ago committed by GitHub
commit dde0b60e83

@ -25,6 +25,21 @@ def ssh_args(label):
return args + [identity['host']]
def mosh_args(label):
"""Create SSH command for connecting specified server."""
identity = device.interface.string_to_identity(label)
args = []
if 'port' in identity:
args += ['-p', identity['port']]
if 'user' in identity:
args += [identity['user']+'@'+identity['host']]
else:
args += [identity['host']]
return args
def create_parser():
"""Create argparse.ArgumentParser for this tool."""
p = argparse.ArgumentParser()
@ -148,7 +163,7 @@ def run_agent(client_factory=client.Client):
if args.connect:
command = ['ssh'] + ssh_args(args.identity) + args.command
elif args.mosh:
command = ['mosh'] + ssh_args(args.identity) + args.command
command = ['mosh'] + mosh_args(args.identity) + args.command
else:
command = args.command

Loading…
Cancel
Save