Fixing pssh (parallel-ssh) Problems on Debian 10 with Python 3.7
Python reminds me of PHP many years ago, when multiple incompatible versions could exist on one server. Do you need another version? The best solution back then was a new server, because any update or installation could break the entire global environment.
Half a year after the “Sunsetting Python 2”, major distributions still continue to install Python 2 by default, and it becomes a challenge not to replace the default version after some update or after installing a new package.
What happened? For debugging purposes I decided to try pssh (now parallel-ssh… WTF?) on Debian 10 with Python 3.7. And what do I see? Debian, as always, can’t collect all required dependencies for deb packages… After installation — time to fix some bugs:
BUG1
server:~$ parallel-ssh --version
Traceback (most recent call last):
File "/usr/bin/parallel-ssh", line 26, in <module>
from psshlib.cli import common_parser, common_defaults
File "/usr/local/lib/python3.7/dist-packages/psshlib/cli.py", line 9, in <module>
import version
ModuleNotFoundError: No module named 'version'
FIX1
server:~$ diff /usr/local/lib/python3.7/dist-packages/psshlib/cli.py /usr/local/lib/python3.7/dist-packages/psshlib/cli.py_orig
9c9
< from psshlib import version
---
> import version
BUG2
server:~$ parallel-ssh -i -h ~/.pssh_hosts_files -p 10 hostname
Traceback (most recent call last):
File "/usr/bin/parallel-ssh", line 118, in <module>
do_pssh(hosts, cmdline, opts)
File "/usr/bin/parallel-ssh", line 71, in do_pssh
manager = Manager(opts)
File "/usr/local/lib/python3.7/dist-packages/psshlib/manager.py", line 42, in __init__
self.iomap = IOMap()
File "/usr/local/lib/python3.7/dist-packages/psshlib/manager.py", line 215, in __init__
signal.set_wakeup_fd(wakeup_writefd)
ValueError: the fd 4 must be in non-blocking mode
FIX2
server:~$ diff /usr/local/lib/python3.7/dist-packages/psshlib/manager.py /usr/local/lib/python3.7/dist-packages/psshlib/manager.py_orig
9d8
< import fcntl
213d211
> fcntl.fcntl(wakeup_writefd, fcntl.F_SETFL, os.O_NONBLOCK)
P.S.
You must be happy after the Python upgrade! Shut up and smile!
Comments
Post a Comment