diff options
-rw-r--r-- | .cirrus.yml | 1 | ||||
-rw-r--r-- | snap/snapcraft.yaml | 1 | ||||
-rw-r--r-- | sos/collector/clusters/pacemaker.py | 4 | ||||
-rw-r--r-- | sos/collector/sosnode.py | 2 | ||||
-rw-r--r-- | sos/utilities.py | 11 |
5 files changed, 16 insertions, 3 deletions
diff --git a/.cirrus.yml b/.cirrus.yml index feb0cf9b..ecc57a44 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -167,6 +167,7 @@ report_stageone_task: apt -y install python3-pip snapd systemctl start snapd snap install ./sosreport_test_amd64.snap --classic --dangerous + snap alias sosreport.sos sos fi if [ $(command -v dnf) ]; then echo "$ARTCURL/rpm%20Build%20From%20Checkout%20-%20${BUILD_NAME}/packages/sos_${BUILD_NAME}.rpm" diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 2fe65699..1b9421f7 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -30,6 +30,7 @@ parts: - setuptools - wheel - python_magic + - packaging apps: sos: diff --git a/sos/collector/clusters/pacemaker.py b/sos/collector/clusters/pacemaker.py index bebcb265..c83f8c3c 100644 --- a/sos/collector/clusters/pacemaker.py +++ b/sos/collector/clusters/pacemaker.py @@ -11,7 +11,7 @@ import re from sos.collector.clusters import Cluster -from setuptools._vendor.packaging import version +from sos.utilities import parse_version from xml.etree import ElementTree @@ -63,7 +63,7 @@ class pacemaker(Cluster): _ver = self.exec_primary_cmd('crm_mon --version') if _ver['status'] == 0: cver = _ver['output'].split()[1].split('-')[0] - if not version.parse(cver) > version.parse('2.0.3'): + if not parse_version(cver) > parse_version('2.0.3'): xmlopt = '--as-xml' else: return diff --git a/sos/collector/sosnode.py b/sos/collector/sosnode.py index 38f739d7..1562db9a 100644 --- a/sos/collector/sosnode.py +++ b/sos/collector/sosnode.py @@ -14,7 +14,6 @@ import logging import os import re -from pkg_resources import parse_version from pipes import quote from sos.policies import load from sos.policies.init_systems import InitSystem @@ -26,6 +25,7 @@ from sos.collector.exceptions import (CommandTimeoutException, ConnectionException, UnsupportedHostException, InvalidTransportException) +from sos.utilities import parse_version TRANSPORTS = { 'local': LocalTransport, diff --git a/sos/utilities.py b/sos/utilities.py index 4556632a..a09c9d2c 100644 --- a/sos/utilities.py +++ b/sos/utilities.py @@ -22,6 +22,11 @@ import io from contextlib import closing from collections import deque +try: + from pkg_resources import parse_version as version_parse +except SyntaxError: + from packaging.version import parse as version_parse + # try loading magic>=0.4.20 which implements detect_from_filename method magic_mod = False try: @@ -406,6 +411,12 @@ def recursive_dict_values_by_key(dobj, keys=[]): return [d for d in _items if d not in _filt] +def parse_version(version): + """Parse the version string + """ + return version_parse(version) + + class FakeReader(): """Used as a replacement AsyncReader for when we are writing directly to disk, and allows us to keep more simplified flows for executing, |