-
-
Notifications
You must be signed in to change notification settings - Fork 695
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
community/salt: fix python3.8 incompattibilities
Salt is not compattible with Python 3.8 yet[0], so salt-minion is broken on Alpine Linux since v3.10. Patch the grain code to be compattible with Python 3.8. Fixes #10979 [0]: saltstack/salt#55310
- Loading branch information
Showing
2 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
python 3.8 removed linux_distribution support completely and leaves that | ||
functionality to third-party modules, which is provided by 'distro'. | ||
|
||
Just completely remove the backwards compatibility and completely rely on that | ||
module. | ||
|
||
diff --git a/salt/grains/core.py b/salt/grains/core.py | ||
index f05276c..58edaee 100644 | ||
--- a/salt/grains/core.py | ||
+++ b/salt/grains/core.py | ||
@@ -22,6 +22,7 @@ import locale | ||
import uuid | ||
from errno import EACCES, EPERM | ||
import datetime | ||
+from distro import linux_distribution | ||
|
||
# pylint: disable=import-error | ||
try: | ||
@@ -33,18 +34,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 | ||
-except ImportError: | ||
- from distro import linux_distribution | ||
- | ||
# Import salt libs | ||
import salt.exceptions | ||
import salt.log | ||
@@ -1871,7 +1860,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 |