[Pkg-salt-team] Bug#968591: tornado patches are incomplete

Jamie Heilman jamie at audible.transient.net
Tue Aug 18 08:18:26 BST 2020


Package: salt-api
Version: 2018.3.4+dfsg1-6+deb10u1

Debian ships 3 patches from Benjamin Drung to make salt use the
python3-tornado4 package:
 0001-Import-tornado.gen-as-tornado_gen.patch
 0002-Explicitly-import-attributes-from-tornado.patch
 0003-Use-renamed-python3-tornado4.patch

The 3rd patch is incomplete, and as a result the rest_tornado netapi
module is totally broken.  If one configures rest_tornado[1] and tries
to start salt-api, the result is:

Process salt.loaded.int.netapi.rest_tornado.start:
Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3/dist-packages/salt/netapi/rest_tornado/__init__.py", line 127, in start
    from tornado.httpserver import HTTPServer
ModuleNotFoundError: No module named 'tornado'

If you make the unfortunate detour of installing python3-tornado, or
already have it installed for other reasons, salt-api will start, but
it won't work at all, connections to the configured port simply hang.

The fix is straightforward; here it is in the form of a direct patch
against the offending source file:

--- /usr/lib/python3/dist-packages/salt/netapi/rest_tornado/__init__.py.orig   2020-08-18 07:06:32.922033000 +0000
+++ /usr/lib/python3/dist-packages/salt/netapi/rest_tornado/__init__.py 2020-08-18 06:45:28.007820241 +0000
@@ -124,7 +124,10 @@
             ssl_opts.update({'keyfile': mod_opts['ssl_key']})
         kwargs['ssl_options'] = ssl_opts
 
-    from tornado.httpserver import HTTPServer
+    try:
+        from tornado4.httpserver import HTTPServer
+    except ImportError:
+        from tornado.httpserver import HTTPServer
     http_server = HTTPServer(get_application(__opts__), **kwargs)
     try:
         http_server.bind(mod_opts['port'],

or you could just append the same hunk to the
salt/netapi/rest_tornado/__init__.py section of
debian/patches/0003-Use-renamed-python3-tornado4.patch


-- 
Jamie Heilman                     http://audible.transient.net/~jamie/

[1] https://docs.saltstack.com/en/latest/ref/netapi/all/salt.netapi.rest_tornado.html#module-salt.netapi.rest_tornado



More information about the pkg-salt-team mailing list