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 16, 2024
1 parent 2a26a83 commit 1a80eee
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

Check warning on line 216 in crmsh/migration.py

View check run for this annotation

Codecov / codecov/patch

crmsh/migration.py#L210-L216

Added lines #L210 - L216 were not covered by tests
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(

Check warning on line 222 in crmsh/migration.py

View check run for this annotation

Codecov / codecov/patch

crmsh/migration.py#L218-L222

Added lines #L218 - L222 were not covered by tests
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 1a80eee

Please sign in to comment.