Skip to content

Commit

Permalink
Dev: pre-migration: add checks for package version (jsc#PED-8252)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasyang2022 committed Dec 13, 2024
1 parent 14cfeab commit 70f74a6
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 @@ -212,11 +212,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 70f74a6

Please sign in to comment.