-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev: adds a new command $ crm check migration
This new command checks if the migration from sle15 to sle16 is safe. (ref: PED-8270)
- Loading branch information
Aleksei Burlakov
committed
May 6, 2024
1 parent
73eaf02
commit 21b734b
Showing
3 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright (C) 2024 Aleksei Burlakov <[email protected]> | ||
# See COPYING for license information. | ||
from . import command | ||
from . import log | ||
from typing import Tuple | ||
from crmsh.report import utils as report_utils | ||
from crmsh import utils as just_utils | ||
|
||
logger = log.setup_logger(__name__) | ||
|
||
class Check(command.UI): | ||
''' | ||
Check that migration to sle16 is safe | ||
- Packages installed correctly | ||
- T.B.A. | ||
''' | ||
name = "check" | ||
|
||
def requires(self): | ||
return True | ||
|
||
def __init__(self): | ||
command.UI.__init__(self) | ||
|
||
def check_version_SAPHanaSR(self) -> Tuple[int, str]: | ||
pkg = report_utils.Package('SAPHanaSR') | ||
SAPHanaSR_current_version = pkg.pkg_ver_rpm('%{VERSION}') | ||
SAPHanaSR_minimum_version = '0.162.2' | ||
if SAPHanaSR_current_version == '': | ||
return -1, 'SAPHanaSR is not installed' | ||
|
||
if not just_utils.is_larger_than_min_version(SAPHanaSR_current_version, SAPHanaSR_minimum_version): | ||
return -1, f'SAPHanaSR is too old. Minimum required version {SAPHanaSR_minimum_version}' | ||
|
||
return 0, '' | ||
|
||
def check_version_FOOPackage(self) -> Tuple[int, str]: | ||
if False: | ||
return -1, 'Check has failed' | ||
return 0, '' | ||
|
||
@command.skill_level('administrator') | ||
def do_migration(self, context, *args): | ||
'usage: migration' | ||
|
||
rc, errmsg = self.check_version_SAPHanaSR() | ||
|
||
if rc == 0: | ||
print(f'OK: SAPHanaSR') | ||
else: | ||
print(f'FAIL: SAPHanaSR: {errmsg}') | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters