1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
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 04c1ae9..9280975 100644
--- a/salt/grains/core.py
+++ b/salt/grains/core.py
@@ -24,6 +24,7 @@ from errno import EACCES, EPERM
import datetime
import warnings
import time
+from distro import linux_distribution
# pylint: disable=import-error
try:
@@ -35,23 +36,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
-
- def linux_distribution(**kwargs):
- with warnings.catch_warnings():
- warnings.simplefilter("ignore")
- return _deprecated_linux_distribution(**kwargs)
-except ImportError:
- from distro import linux_distribution
-
# Import salt libs
import salt.exceptions
import salt.log
@@ -1920,7 +1904,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
|