Skip to content

Commit

Permalink
Dev: pre-migration: add checks for package version (jsc#PED-11808)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasyang2022 committed Dec 17, 2024
1 parent d842bc1 commit 156fdf2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions crmsh/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,18 @@ def check_dependency_version(handler: CheckResultHandler):
handler.log_info('Checking dependency version...')
shell = sh.LocalShell()
out = shell.get_stdout_or_raise_error(None, 'corosync -v')
match = re.search(r"version\s+'((\d+)(?:\.\d+)*)'", out)
if not match or match.group(2) != '3':
match = re.search(r"version\s+'(\d+(?:\.\d+)*)'", out)
corosync_supported = True
if not match:
corosync_supported = False
else:
version = tuple(int(x) for x in match.group(1).split('.'))
if not (2, 4, 6) <= version < (3,):
corosync_supported = False
if not corosync_supported:
handler.handle_problem(
False, 'Corosync version not supported', [
'Supported version: corosync >= 3',
'Supported version: 2.4.6 <= corosync < 3',
f'Actual version: corosync == {match.group(1)}',
],
)
Expand Down

0 comments on commit 156fdf2

Please sign in to comment.