diff --git a/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py b/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py index 9e213f644c..5493119809 100644 --- a/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py +++ b/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py @@ -50,12 +50,16 @@ def get_os_release(path): try: with open(path) as f: data = dict(l.strip().split('=', 1) for l in f.readlines() if '=' in l) + release_id = data.get('ID', '').strip('"') + version_id = data.get('VERSION_ID', '').strip('"') + if release_id == 'centos' and '.' not in version_id: + version_id = "{}.999".format(version_id) return OSRelease( - release_id=data.get('ID', '').strip('"'), + release_id=release_id, name=data.get('NAME', '').strip('"'), pretty_name=data.get('PRETTY_NAME', '').strip('"'), version=data.get('VERSION', '').strip('"'), - version_id=data.get('VERSION_ID', '').strip('"'), + version_id=version_id, variant=data.get('VARIANT', '').strip('"') or None, variant_id=data.get('VARIANT_ID', '').strip('"') or None ) diff --git a/repos/system_upgrade/common/actors/ipuworkflowconfig/tests/files/os-release-stream8 b/repos/system_upgrade/common/actors/ipuworkflowconfig/tests/files/os-release-stream8 new file mode 100644 index 0000000000..8948e12f4a --- /dev/null +++ b/repos/system_upgrade/common/actors/ipuworkflowconfig/tests/files/os-release-stream8 @@ -0,0 +1,13 @@ +NAME="CentOS Stream" +VERSION="8" +ID="centos" +ID_LIKE="rhel fedora" +VERSION_ID="8" +PLATFORM_ID="platform:el8" +PRETTY_NAME="CentOS Stream 8" +ANSI_COLOR="0;31" +CPE_NAME="cpe:/o:centos:centos:8" +HOME_URL="https://centos.org/" +BUG_REPORT_URL="https://bugzilla.redhat.com/" +REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 8" +REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream" diff --git a/repos/system_upgrade/common/actors/ipuworkflowconfig/tests/test_ipuworkflowconfig.py b/repos/system_upgrade/common/actors/ipuworkflowconfig/tests/test_ipuworkflowconfig.py index a5e4d03bcd..a9369bedca 100644 --- a/repos/system_upgrade/common/actors/ipuworkflowconfig/tests/test_ipuworkflowconfig.py +++ b/repos/system_upgrade/common/actors/ipuworkflowconfig/tests/test_ipuworkflowconfig.py @@ -63,6 +63,17 @@ def test_get_os_release_info(monkeypatch): ipuworkflowconfig.get_os_release(os.path.join(CUR_DIR, 'files/non-existent-file')) +def test_get_os_release_info_centos_stream(monkeypatch): + expected = OSRelease( + release_id='centos', + name='CentOS Stream', + pretty_name='CentOS Stream 8', + version='8', + version_id='8.999' + ) + assert expected == ipuworkflowconfig.get_os_release(os.path.join(CUR_DIR, 'files/os-release-stream8')) + + def test_get_booted_kernel(monkeypatch): monkeypatch.setattr(ipuworkflowconfig, 'run', lambda x: {'stdout': '4.14.0-100.8.2.el7a.x86_64\n'}) assert ipuworkflowconfig.get_booted_kernel() == '4.14.0-100.8.2.el7a.x86_64'