diff --git a/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py b/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py index 73197e0b39..7abb2b4227 100644 --- a/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py +++ b/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py @@ -51,8 +51,12 @@ 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: + os_version = "{}.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('"'), diff --git a/repos/system_upgrade/common/libraries/config/version.py b/repos/system_upgrade/common/libraries/config/version.py index 95f0d23170..5eb80c9c54 100644 --- a/repos/system_upgrade/common/libraries/config/version.py +++ b/repos/system_upgrade/common/libraries/config/version.py @@ -16,7 +16,7 @@ _SUPPORTED_VERSIONS = { # Note: 'rhel-alt' is detected when on 'rhel' with kernel 4.x '7': {'rhel': ['7.9'], 'rhel-alt': [], 'rhel-saphana': ['7.9'], 'centos': ['7.9'], 'eurolinux': ['7.9'], 'ol': ['7.9'], 'scientific': ['7.9']}, - '8': {'rhel': ['8.5', '8.6', '8.8', '8.9', '8.10'], 'rhel-saphana': ['8.6', '8.8', '8.9', '8.10'], 'centos': ['8.5'], 'almalinux': ['8.6', '8.7', '8.8', '8.9', '8.10'], 'eurolinux': ['8.6', '8.7', '8.8', '8.9', '8.10'], 'ol': ['8.6', '8.7', '8.8', '8.9', '8.10'], 'rocky': ['8.6', '8.7', '8.8', '8.9', '8.10']}, + '8': {'rhel': ['8.5', '8.6', '8.8', '8.9', '8.10'], 'rhel-saphana': ['8.6', '8.8', '8.9', '8.10'], 'centos': ['8.5', '8.999'], 'almalinux': ['8.6', '8.7', '8.8', '8.9', '8.10'], 'eurolinux': ['8.6', '8.7', '8.8', '8.9', '8.10'], 'ol': ['8.6', '8.7', '8.8', '8.9', '8.10'], 'rocky': ['8.6', '8.7', '8.8', '8.9', '8.10']}, } diff --git a/repos/system_upgrade/common/libraries/module.py b/repos/system_upgrade/common/libraries/module.py index abde69e703..7d4e8aa43b 100644 --- a/repos/system_upgrade/common/libraries/module.py +++ b/repos/system_upgrade/common/libraries/module.py @@ -1,4 +1,3 @@ -import os import warnings from leapp.libraries.common.config.version import get_source_major_version @@ -23,14 +22,20 @@ def _create_or_get_dnf_base(base=None): # have repositories only for the exact system version (including the minor number). In a case when # /etc/yum/vars/releasever is present, read its contents so that we can access repositores on such systems. conf = dnf.conf.Conf() - pkg_manager = 'yum' if get_source_major_version() == '7' else 'dnf' - releasever_path = '/etc/{0}/vars/releasever'.format(pkg_manager) - if os.path.exists(releasever_path): - with open(releasever_path) as releasever_file: - releasever = releasever_file.read().strip() - conf.substitutions['releasever'] = releasever - else: - conf.substitutions['releasever'] = get_source_major_version() + + # preload releasever from what we know, this will be our fallback + conf.substitutions['releasever'] = get_source_major_version() + + # dnf on EL7 doesn't load vars from /etc/yum, so we need to help it a bit + if get_source_major_version() == '7': + try: + with open('/etc/yum/vars/releasever') as releasever_file: + conf.substitutions['releasever'] = releasever_file.read().strip() + except IOError: + pass + + # load all substitutions from etc + conf.substitutions.update_from_etc('/') base = dnf.Base(conf=conf) base.init_plugins()