Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

salt-ssh failed to run after the python had been updated to 3.8 #55601

Closed
gray380 opened this issue Dec 11, 2019 · 3 comments
Closed

salt-ssh failed to run after the python had been updated to 3.8 #55601

gray380 opened this issue Dec 11, 2019 · 3 comments
Assignees
Labels
Duplicate Duplicate of another issue or PR - will be closed

Comments

@gray380
Copy link

gray380 commented Dec 11, 2019

Description of Issue

salt-ssh failed to run after the python had been updated to 3.8

Setup

salt-ssh was in the normal condition and worked fine before python upgrade have been done
I've tried the following workaround:

source venv/bin/activate
pip install distro
pip install salt-ssh

Steps to Reproduce Issue

$ salt-ssh
Traceback (most recent call last):
  File "/home/gray/salt/venv/bin/salt-ssh", line 8, in <module>
    sys.exit(salt_ssh())
  File "/home/gray/salt/venv/lib/python3.8/site-packages/salt/scripts.py", line 450, in salt_ssh
    import salt.cli.ssh
  File "/home/gray/salt/venv/lib/python3.8/site-packages/salt/cli/ssh.py", line 5, in <module>
    import salt.client.ssh
  File "/home/gray/salt/venv/lib/python3.8/site-packages/salt/client/__init__.py", line 30, in <module>
    import salt.config
  File "/home/gray/salt/venv/lib/python3.8/site-packages/salt/config/__init__.py", line 99, in <module>
    _DFLT_IPC_WBUFFER = _gather_buffer_space() * .5
  File "/home/gray/salt/venv/lib/python3.8/site-packages/salt/config/__init__.py", line 88, in _gather_buffer_space
    import salt.grains.core
  File "/home/gray/salt/venv/lib/python3.8/site-packages/salt/grains/core.py", line 40, in <module>
    from platform import _supported_dists
ImportError: cannot import name '_supported_dists' from 'platform' (/usr/lib64/python3.8/platform.py)

Versions Report

N/A

@gray380
Copy link
Author

gray380 commented Dec 24, 2019

So is there any way to solve the issue?

salt-ssh$ pip list
Package    Version   
---------- ----------
certifi    2019.11.28
chardet    3.0.4     
distro     1.4.0     
idna       2.8       
Jinja2     2.10.3    
MarkupSafe 1.1.1     
msgpack    0.6.2     
pip        19.3.1    
PyYAML     3.13      
requests   2.22.0    
salt-ssh   2019.2.2  
setuptools 42.0.2    
tornado    4.5.3     
urllib3    1.25.7    
wheel      0.33.6

@peterhirn
Copy link

This is a duplicate of Python 3.8 Support #55310

As a workaround you can patch salt/grains/core.py:

diff --git "a/salt/grains/core.py" "b/salt/grains/core.py"
index a3be0b8a1c..ff548923f4 100644
--- "a/salt/grains/core.py"
+++ "b/salt/grains/core.py"
@@ -35,12 +35,6 @@ except ImportError:
 __proxyenabled__ = ['*']
 __FQDN__ = None
 
-# Extend the default list of supported distros. This will be used for the
-# /etc/DISTRO-release checking that is part of linux_distribution()
-from platform import _supported_dists
-_supported_dists += ('arch', 'mageia', 'meego', 'vmware', 'bluewhite64',
-                     'slamd64', 'ovs', 'system', 'mint', 'oracle', 'void')
-
 # linux_distribution deprecated in py3.7
 try:
     from platform import linux_distribution as _deprecated_linux_distribution
@@ -1939,7 +1933,7 @@ def os_data():
         )
         (osname, osrelease, oscodename) = \
             [x.strip('"').strip("'") for x in
-             linux_distribution(supported_dists=_supported_dists)]
+             linux_distribution()]
         # Try to assign these three names based on the lsb info, they tend to
         # be more accurate than what python gets from /etc/DISTRO-release.
         # It's worth noting that Ubuntu has patched their Python distribution

Then you should be able to start salt-ssh, salt-call without the exception but you might run into other issues.

@waynew waynew added Duplicate Duplicate of another issue or PR - will be closed and removed needs-triage labels Dec 30, 2019
@waynew
Copy link
Contributor

waynew commented Dec 30, 2019

Closing this, as @peterhirn points out it's a dupe of #55310

@waynew waynew closed this as completed Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Duplicate of another issue or PR - will be closed
Projects
None yet
Development

No branches or pull requests

4 participants