From 8ad024515ed4b9e3df05157c67938d700eee5fa8 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Thu, 16 May 2024 11:54:17 +0200 Subject: [PATCH 42/49] report which OS release was detected as unsupported --- .../common/actors/checkosrelease/libraries/checkosrelease.py | 5 ++++- .../actors/checkosrelease/tests/test_checkosrelease.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/repos/system_upgrade/common/actors/checkosrelease/libraries/checkosrelease.py b/repos/system_upgrade/common/actors/checkosrelease/libraries/checkosrelease.py index bbc6b5ae..1ee6e6ab 100644 --- a/repos/system_upgrade/common/actors/checkosrelease/libraries/checkosrelease.py +++ b/repos/system_upgrade/common/actors/checkosrelease/libraries/checkosrelease.py @@ -30,13 +30,16 @@ def check_os_version(): for rel in version.SUPPORTED_VERSIONS: for ver in version.SUPPORTED_VERSIONS[rel]: supported_releases.append(rel.upper() + ' ' + ver) + current_release = ' '.join(version.current_version()).upper() reporting.create_report([ reporting.Title( 'The installed OS version is not supported for the in-place upgrade to the target RHEL version' ), reporting.Summary( 'The supported OS releases for the upgrade process:' - '{}{}'.format(FMT_LIST_SEPARATOR, FMT_LIST_SEPARATOR.join(supported_releases)) + '{}{}\n\nThe detected OS release is: {}'.format(FMT_LIST_SEPARATOR, + FMT_LIST_SEPARATOR.join(supported_releases), + current_release) ), reporting.Severity(reporting.Severity.HIGH), reporting.Groups(COMMON_REPORT_TAGS), diff --git a/repos/system_upgrade/common/actors/checkosrelease/tests/test_checkosrelease.py b/repos/system_upgrade/common/actors/checkosrelease/tests/test_checkosrelease.py index 99d19832..aa0fd636 100644 --- a/repos/system_upgrade/common/actors/checkosrelease/tests/test_checkosrelease.py +++ b/repos/system_upgrade/common/actors/checkosrelease/tests/test_checkosrelease.py @@ -28,6 +28,7 @@ def test_no_skip_check(monkeypatch): def test_not_supported_release(monkeypatch): monkeypatch.setattr(version, "is_supported_version", lambda: False) monkeypatch.setattr(version, "get_source_major_version", lambda: '7') + monkeypatch.setattr(version, "current_version", lambda: ('bad', '7')) monkeypatch.setattr(reporting, "create_report", create_report_mocked()) checkosrelease.check_os_version() -- 2.44.0