diff --git a/coriolis/osmorphing/centos.py b/coriolis/osmorphing/centos.py index 60a78e08..bc5db84a 100644 --- a/coriolis/osmorphing/centos.py +++ b/coriolis/osmorphing/centos.py @@ -7,14 +7,16 @@ CENTOS_DISTRO_IDENTIFIER = centos_detect.CENTOS_DISTRO_IDENTIFIER +CENTOS_STREAM_DISTRO_IDENTIFIER = centos_detect.CENTOS_STREAM_DISTRO_IDENTIFIER class BaseCentOSMorphingTools(redhat.BaseRedHatMorphingTools): @classmethod def check_os_supported(cls, detected_os_info): - if detected_os_info['distribution_name'] != ( - CENTOS_DISTRO_IDENTIFIER): + supported_oses = [ + CENTOS_STREAM_DISTRO_IDENTIFIER, CENTOS_DISTRO_IDENTIFIER] + if detected_os_info['distribution_name'] not in supported_oses: return False return cls._version_supported_util( detected_os_info['release_version'], minimum=6) diff --git a/coriolis/osmorphing/osdetect/centos.py b/coriolis/osmorphing/osdetect/centos.py index 414d521a..012c741c 100644 --- a/coriolis/osmorphing/osdetect/centos.py +++ b/coriolis/osmorphing/osdetect/centos.py @@ -4,13 +4,13 @@ import re from oslo_log import log as logging - from coriolis import constants from coriolis.osmorphing.osdetect import base LOG = logging.getLogger(__name__) CENTOS_DISTRO_IDENTIFIER = "CentOS" +CENTOS_STREAM_DISTRO_IDENTIFIER = "CentOS Stream" class CentOSOSDetectTools(base.BaseLinuxOSDetectTools): @@ -22,19 +22,22 @@ def detect_os(self): release_info = self._read_file( redhat_release_path).decode().splitlines() if release_info: - m = re.match(r"^(.*) release ([0-9].*) \((.*)\).*$", + m = re.match(r"^(.*) release ([0-9](\.[0-9])*)( \(.*\))?.*$", release_info[0].strip()) if m: - distro, version, _ = m.groups() + distro, version, _, _ = m.groups() if CENTOS_DISTRO_IDENTIFIER not in distro: LOG.debug( "Distro does not appear to be a CentOS: %s", distro) return {} + distribution_name = CENTOS_DISTRO_IDENTIFIER + if CENTOS_STREAM_DISTRO_IDENTIFIER in distro: + distribution_name = CENTOS_STREAM_DISTRO_IDENTIFIER info = { "os_type": constants.OS_TYPE_LINUX, - "distribution_name": CENTOS_DISTRO_IDENTIFIER, + "distribution_name": distribution_name, "release_version": version, "friendly_release_name": "%s Version %s" % ( - CENTOS_DISTRO_IDENTIFIER, version)} + distribution_name, version)} return info