aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2018-12-26 13:34:33 -0500
committerBryn M. Reeves <bmr@redhat.com>2019-03-19 18:56:32 +0000
commitce9b8052e66052473a1d3457452f55b65730ace0 (patch)
tree481f5d12a4868a241c6de246b5e3feae9f923842
parent9dc6b75f76062315c58196c51ffe9d1319988520 (diff)
downloadsos-ce9b8052e66052473a1d3457452f55b65730ace0.tar.gz
[python] Update plugin to run properly on RHEL 8
RHEL 8 replaces the standard 'python' binary with platform-python, following PEP394. RHEL 8 sysadmins can however install python2 and/or python3 alongside this system installation of python and optionally also set 'python' to point to either of these installations. This updates the python plugin to enable on the presence of any of these packages and also get version information for any version of python installed, including the platform-python installation. Resolves: #1524 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/python.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/sos/plugins/python.py b/sos/plugins/python.py
index 2c91f406..003fd308 100644
--- a/sos/plugins/python.py
+++ b/sos/plugins/python.py
@@ -11,7 +11,7 @@
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-class Python(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
+class Python(Plugin, DebianPlugin, UbuntuPlugin):
"""Python runtime
"""
@@ -23,4 +23,19 @@ class Python(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
def setup(self):
self.add_cmd_output("python -V", suggest_filename="python-version")
+
+class RedHatPython(Python, RedHatPlugin):
+
+ packages = ('python', 'python36', 'python2', 'platform-python')
+
+ def setup(self):
+ self.add_cmd_output(['python2 -V', 'python3 -V'])
+ if self.policy.dist_version() > 7:
+ self.add_cmd_output(
+ '/usr/libexec/platform-python -V',
+ suggest_filename='python-version'
+ )
+ else:
+ self.add_cmd_output('python -V', suggest_filename='python-version')
+
# vim: set et ts=4 sw=4 :