IMO we should use /usr/bin/ssh - OpenSSH - at least for interactive shells - instead of paramiko, at least for these two reasons:
openssh has some escape sequences for controlling it (search its man page for 'escape'). In particular, <~><.> disconnects the session, which is more convenient than having to search for the stuck lago process and killing it from another shell.
At least once, it failed for me due to the internal shell (inside the host) outputting an invalid UTF-8 sequence, with [1]. This in itself is probably easy to fix by catching the exception.
Pressing 'PageUp'/PageDown' keys inside 'less' does not work. Workaround: export TERM=(your real term) (in my case, 'screen', which is what tmux sets).
[1]
[ *** ] (2 oError occured, aborting
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/lago/ssh.py", line 279, in
drain_ssh_channel
stdout.write(out)
TypeError: write() argument must be str, not bytes
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/lago/cmd.py", line 987, in main
cli_plugins[args.verb].do_run(args)
File "/usr/lib/python3.6/site-packages/lago/plugins/cli.py", line
186, in do_run
self._do_run(vars(args))
File "/usr/lib/python3.6/site-packages/lago/utils.py", line 584, in wrapper
return func(*args, *kwargs)
File "/usr/lib/python3.6/site-packages/lago/utils.py", line 595, in wrapper
return func(args, prefix=prefix, kwargs)
File "/usr/lib/python3.6/site-packages/lago/cmd.py", line 480, in do_shell
result = host.interactive_ssh(['bash'])
File "/usr/lib/python3.6/site-packages/lago/plugins/vm.py", line
106, in wrapper
return func(self, *args, *kwargs)
File "/usr/lib/python3.6/site-packages/lago/plugins/vm.py", line
720, in interactive_ssh
password=self._spec.get('ssh-password'),
File "/usr/lib/python3.6/site-packages/lago/ssh.py", line 205, in
interactive_ssh
return interactive_ssh_channel(channel, ' '.join(command))
File "/usr/lib/python3.6/site-packages/lago/ssh.py", line 314, in
interactive_ssh_channel
return utils.CommandStatus(drain_ssh_channel(chan, stdin))
File "/usr/lib/python3.6/site-packages/lago/ssh.py", line 281, in
drain_ssh_channel
stdout.write(out.decode('utf-8'))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2 in position
31: unexpected end of data
IMO we should use /usr/bin/ssh - OpenSSH - at least for interactive shells - instead of paramiko, at least for these two reasons:
openssh has some escape sequences for controlling it (search its man page for 'escape'). In particular,<~><.> disconnects the session, which is more convenient than having to search for the stuck lago process and killing it from another shell.
At least once, it failed for me due to the internal shell (inside the host) outputting an invalid UTF-8 sequence, with [1]. This in itself is probably easy to fix by catching the exception.
Pressing 'PageUp'/PageDown' keys inside 'less' does not work. Workaround: export TERM=(your real term) (in my case, 'screen', which is what tmux sets).
[1]
[ *** ] (2 oError occured, aborting Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/lago/ssh.py", line 279, in drain_ssh_channel stdout.write(out) TypeError: write() argument must be str, not bytes
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/lago/cmd.py", line 987, in main cli_plugins[args.verb].do_run(args) File "/usr/lib/python3.6/site-packages/lago/plugins/cli.py", line 186, in do_run self._do_run(vars(args)) File "/usr/lib/python3.6/site-packages/lago/utils.py", line 584, in wrapper return func(*args, *kwargs) File "/usr/lib/python3.6/site-packages/lago/utils.py", line 595, in wrapper return func(args, prefix=prefix, kwargs) File "/usr/lib/python3.6/site-packages/lago/cmd.py", line 480, in do_shell result = host.interactive_ssh(['bash']) File "/usr/lib/python3.6/site-packages/lago/plugins/vm.py", line 106, in wrapper return func(self, *args, *kwargs) File "/usr/lib/python3.6/site-packages/lago/plugins/vm.py", line 720, in interactive_ssh password=self._spec.get('ssh-password'), File "/usr/lib/python3.6/site-packages/lago/ssh.py", line 205, in interactive_ssh return interactive_ssh_channel(channel, ' '.join(command)) File "/usr/lib/python3.6/site-packages/lago/ssh.py", line 314, in interactive_ssh_channel return utils.CommandStatus(drain_ssh_channel(chan, stdin)) File "/usr/lib/python3.6/site-packages/lago/ssh.py", line 281, in drain_ssh_channel stdout.write(out.decode('utf-8')) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2 in position 31: unexpected end of data