Skip to content

Commit

Permalink
Merge pull request #107 from yuravk/almalinux-ng
Browse files Browse the repository at this point in the history
Enable CentOS Stream release 8 to 9 elevation
  • Loading branch information
andrewlukoshko authored Apr 22, 2024
2 parents c2787a6 + 5d27743 commit 1b919f9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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('"'),
Expand Down
2 changes: 1 addition & 1 deletion repos/system_upgrade/common/libraries/config/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']},
}


Expand Down
23 changes: 14 additions & 9 deletions repos/system_upgrade/common/libraries/module.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import warnings

from leapp.libraries.common.config.version import get_source_major_version
Expand All @@ -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()
Expand Down

0 comments on commit 1b919f9

Please sign in to comment.