Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 'epicli upgrade' for RHEL/AlmaLinux 8 #3154

Merged
merged 16 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions ansible/playbooks/roles/preflight/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
- include_tasks: upgrade-pre-common.yml
when: is_upgrade_run

- include_tasks: common/main.yml

- include_tasks: apply.yml
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ packages:
- 'nss' # for java-1.8.0-openjdk-headless
- 'nss-softokn' # for nss
# Open Distro for Elasticsearch plugins are installed individually to not download them twice in different versions (as dependencies of opendistroforelasticsearch package)
- 'ntsysv' # for python36
- 'opendistro-alerting-1.13.1.*'
- 'opendistro-index-management-1.13.1.*'
- 'opendistro-job-scheduler-1.13.0.*'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ class Dnf(Command):
def __init__(self, retries: int):
super().__init__('dnf', retries)

def update(self, enablerepo: str = None,
package: str = None,
def update(self, package: str = None,
disablerepo: str = None,
enablerepo: str = None,
releasever: str = None,
assume_yes: bool = True):

"""
Interface for `dnf update`

:param enablerepo:
:param package:
:param disablerepo:
:param enablerepo:
:param releasever:
:param assume_yes: if set to True, -y flag will be used
"""
update_parameters: List[str] = ['update']
Expand All @@ -38,6 +41,9 @@ def update(self, enablerepo: str = None,
if enablerepo is not None:
update_parameters.append(f'--enablerepo={enablerepo}')

if releasever is not None:
update_parameters.append(f'--releasever={releasever}')

proc = self.run(update_parameters)

if 'error' in proc.stdout:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from src.command.command import Command
from src.error import DnfVariableNotfound


class DnfConfigManager(Command):
Expand All @@ -17,3 +18,19 @@ def disable_repo(self, repo: str):

def enable_repo(self, repo: str):
self.run(['config-manager', '--set-enabled', repo])

def get_variable(self, name: str) -> str:
process = self.run(['config-manager', '--dump-variables'])
variables = [x for x in process.stdout.splitlines() if '=' in x]
value = None

for var in variables:
chunks = var.split('=', maxsplit=1)
if name == chunks[0].strip():
value = chunks[1].strip()
break

if not value:
raise DnfVariableNotfound(f'Variable not found: {name}')

return value
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ class CriticalError(DownloadRequirementsError):
"""


class DnfVariableNotfound(CriticalError):
"""
Raised when DNF variable was not found.
"""


class PackageNotfound(CriticalError):
"""
Raised when there was no package found by the query tool.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def _create_backup_repositories(self):
def _install_base_packages(self):

# Bug in RHEL 8.4 https://bugzilla.redhat.com/show_bug.cgi?id=2004853
self._tools.dnf.update(package='libmodulemd')
releasever = '8' if self._tools.dnf_config_manager.get_variable('releasever') == '8.4' else None
self._tools.dnf.update(package='libmodulemd', releasever=releasever)

# some packages are from EPEL repo
# make sure that we reinstall it before proceeding
Expand Down
4 changes: 1 addition & 3 deletions ansible/playbooks/upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,7 @@
- include_role:
name: postgresql
tasks_from: upgrade/nodes/common/ensure-ansible-requirements
when:
- ansible_os_family == 'Debian'
- "'postgresql' in upgrade_components or upgrade_components|length == 0"
when: "'postgresql' in upgrade_components or upgrade_components|length == 0"

# step 2: upgrade repmgr
- include_role:
Expand Down
Loading