From f7a56df26ba08bfac661b3a49e25c919f16dcdc9 Mon Sep 17 00:00:00 2001 From: Weisson Date: Mon, 6 Mar 2023 14:18:08 +0800 Subject: [PATCH] Provides more information for debug purpose when exception happens in system requirement check. Signed-off-by: Weisson --- ...formation-for-debug-purpose-when-exc.patch | 42 +++++++++++++++++++ leapp-repository.spec | 6 ++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 0038-Provides-more-information-for-debug-purpose-when-exc.patch diff --git a/0038-Provides-more-information-for-debug-purpose-when-exc.patch b/0038-Provides-more-information-for-debug-purpose-when-exc.patch new file mode 100644 index 0000000..49919ae --- /dev/null +++ b/0038-Provides-more-information-for-debug-purpose-when-exc.patch @@ -0,0 +1,42 @@ +From 5574f75fb144b4d8da6f6c4bfcb1e27d55ba741b Mon Sep 17 00:00:00 2001 +From: Weisson +Date: Mon, 6 Mar 2023 14:04:15 +0800 +Subject: [PATCH] Provides more information for debug purpose when exception + happens in system requirement check. + +Signed-off-by: Weisson +--- + .../actors/systemrequirementschecker/actor.py | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/repos/system_upgrade/el7toel8/actors/systemrequirementschecker/actor.py b/repos/system_upgrade/el7toel8/actors/systemrequirementschecker/actor.py +index 2757152..242a6ff 100644 +--- a/repos/system_upgrade/el7toel8/actors/systemrequirementschecker/actor.py ++++ b/repos/system_upgrade/el7toel8/actors/systemrequirementschecker/actor.py +@@ -2,6 +2,10 @@ from leapp.actors import Actor + from leapp import tags + from leapp.libraries.actor import systemchecker + ++from leapp.exceptions import SystemEnvironmentCheckError, FailureInSystemEnvironmentCheckError ++import sys ++import traceback ++ + + class SystemRequirementsChecker(Actor): + """ +@@ -18,5 +22,10 @@ class SystemRequirementsChecker(Actor): + vm_info = sc.virtual_memory() + partition = sc.partition_size_from_directory("/var/lib/leapp/") + +- assert partition['free'] >= 4 * 1024 * 1024 * 1024 and vm_info['free'] >= 600 * 1024 * 1024, "To ensure the migration, this machine must have 4G free space on disk and 600M RAM available." +- assert sc.initd_is_symlink(), "It is crucial that /etc/init.d be a symlink to rc.d/init.d by default." ++ try: ++ assert partition['free'] >= 4 * 1024 * 1024 * 1024 and vm_info['free'] >= 600 * 1024 * 1024, "To ensure the migration, this machine must have 4G free space on disk and 600M RAM available." ++ assert sc.initd_is_symlink(), "It is crucial that /etc/init.d be a symlink to rc.d/init.d by default." ++ except AssertionError as e: ++ raise SystemEnvironmentCheckError(message=e.message, traceback=''.join(traceback.format_exception(*sys.exc_info()))) ++ except Exception as e: ++ raise FailureInSystemEnvironmentCheckError(message="Exception raised in system requirements check.", traceback=''.join(traceback.format_exception(*sys.exc_info()))) +-- +2.35.3 + diff --git a/leapp-repository.spec b/leapp-repository.spec index 3197560..73f535f 100644 --- a/leapp-repository.spec +++ b/leapp-repository.spec @@ -11,7 +11,7 @@ }\ py2_byte_compile "%1" "%2"} -%define anolis_release 16 +%define anolis_release 17 Name: leapp-repository Version: 0.13.0 @@ -63,6 +63,7 @@ Patch34: 0034-migrear-grub2-entry-recovery.patch Patch35: 0035-GRUB2-EFI-support.patch Patch36: 0036-Perform-system-requirements-check-to-ensure-migratio.patch Patch37: 0037-Add-RPMDownloadOrInstallError-and-its-exit-code.patch +Patch38: 0038-Provides-more-information-for-debug-purpose-when-exc.patch BuildArch: noarch BuildRequires: python-devel @@ -191,6 +192,9 @@ done; # no files here %changelog +* Mon Mar 6 2023 Weisson - 0.13.0-2.17 +- Provides more information for debug purpose when exception happens in system requirement check. + * Fri Feb 24 2023 Weisson - 0.13.0-2.16 - Correct python3-psutil requirement branch make migration ARM-EPEL-compatible. -- Gitee