salt: [BUG] v3003 a salt-master using python 3.7+ using salt-ssh cannot work with a minion using python3.5 or 3.6

Setup install salt-ssh on an ubuntu 20.04 box and use it to control an ubuntu 16.04 box (probably happens with centos 7, 8, debian 9, and ubuntu 18.04 as well)

Steps to Reproduce the behavior

salt-ssh \* test.ping
minion-id:
    ----------
    retcode:
        1
    stderr:
        Traceback (most recent call last):
          File "/var/tmp/.root_d24770_salt/salt-call", line 27, in <module>
            salt_call()
          File "/var/tmp/.root_d24770_salt/pyall/salt/scripts.py", line 437, in salt_call
            import salt.cli.call
          File "/var/tmp/.root_d24770_salt/pyall/salt/cli/call.py", line 6, in <module>
            import salt.cli.caller
          File "/var/tmp/.root_d24770_salt/pyall/salt/cli/caller.py", line 14, in <module>
            import salt.loader
          File "/var/tmp/.root_d24770_salt/pyall/salt/loader.py", line 7, in <module>
            import contextvars
          File "/var/tmp/.root_d24770_salt/py3/contextvars.py", line 1, in <module>
            from _contextvars import Context, ContextVar, Token, copy_context
        ImportError: No module named '_contextvars'
    stdout:

I also tried doing pip3 install contextvars immutables --prefix /usr and pip3 install contextvars immutables on the master and it didn’t fix the issue.

Expected behavior

minion-id:
    True

Versions Report

Salt Version:
          Salt: 3003
 
Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: 2.7.3
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.10.1
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 0.6.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: Not Installed
      pycrypto: 2.6.1
  pycryptodome: 3.6.1
        pygit2: Not Installed
        Python: 3.8.5 (default, Jan 27 2021, 15:41:15)
  python-gnupg: 0.4.5
        PyYAML: 5.3.1
         PyZMQ: 18.1.1
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.2
 
System Versions:
          dist: ubuntu 20.04 focal
        locale: utf-8
       machine: x86_64
       release: 5.4.0-70-generic
        system: Linux
       version: Ubuntu 20.04 focal
 

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 30 (13 by maintainers)

Commits related to this issue

Most upvoted comments

The problem still exist with 3004! I’ve found a workaround, but maybe it’s not the right way to “solve” this:

First, i needed to include typing_extensions into the thin package:

~# diff thin.py /usr/local/lib/python3.9/dist-packages/salt/utils/thin.py
30a31
> import typing_extensions
427a429
>         typing_extensions,

And second, the harder part if running on Python 3.5 (yes, ugly…) is a bug in immutables which can be solved with this:

~# diff _protocols.py /usr/local/lib/python3.9/dist-packages/immutables/_protocols.py
6c6
< from typing import NoReturn
---
> #from typing import NoReturn
15a16
>     from typing import NoReturn
18a20
>     from typing_extensions import NoReturn

It will move the import of NoReturn into the section which decides which version of Python is running, as NoReturn is not included in the typing extension of Python 3.5

Sorry for directly pasting diff’s here, but i never did a merge before so maybe someone here is able to do that 😃

Yes is present also in 3004

@sagetherage Given that at least two of us are finding this bug still to be present in 3003.1, please would you reopen this issue? TIA.

I’m also still seeing this with salt-ssh 3003.1 and Ubuntu 18.04 on a target machine.

closing as being released in Salt v3003.1 and will be merged forward into Master after the point release.

@frogunder @Ch3LL if we don’t have a test for this in the packaging tests we should consider adding something see internal slack conversation starting here: https://saltstack.slack.com/archives/C04HEQ97D/p1617221478334300 in releasediscussions

Ideally we’d be able to add a test for this in the regular test suite too. With the docker stuff in pytest we should probably be able to come up with something.