Mosh doesn't support "-l" for user, only user@host for args

This commit is contained in:
Andrew LeCody
2016-12-14 23:59:45 -06:00
parent 0f20bfa239
commit 109bb3b47f

View File

@@ -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