From 6a69cd2fde89fd23219489ffc07d277fcd23ce7c Mon Sep 17 00:00:00 2001 From: Michal Bocek Date: Mon, 2 Dec 2024 17:25:48 +0100 Subject: [PATCH] Additional grub2 config failure msg tweaks --- .../actions/post_conversion/update_grub.py | 12 +++---- convert2rhel/grub.py | 2 ++ .../post_conversion/update_grub_test.py | 33 +++++++++---------- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/convert2rhel/actions/post_conversion/update_grub.py b/convert2rhel/actions/post_conversion/update_grub.py index 3dca47536a..76c24e452c 100644 --- a/convert2rhel/actions/post_conversion/update_grub.py +++ b/convert2rhel/actions/post_conversion/update_grub.py @@ -53,13 +53,11 @@ def run(self): level="WARNING", id="GRUB2_CONFIG_CREATION_FAILED", title="The grub2-mkconfig call failed to complete", - description=( - "The grub2-mkconfig call failed with output:\n'{0}'.\nThe conversion will continue but there" - " may be issues with the current grub2 config and image formats.".format(output.rstrip("\n")) - ), - remediations="If there are issues with the current grub2 config and image we recommend manually " - "re-generating them with 'grub2-mkconfig -o {0}' and" - "'grub2-install [block device, e.g. /dev/sda]'.".format(grub2_config_file), + description="There may be issues with the bootloader configuration." + " Follow the recommended remediation before rebooting the system.", + diagnosis="The grub2-mkconfig call failed with output:\n'{0}'".format(output.rstrip("\n")), + remediations="Resolve the problem reported in the diagnosis and then run 'grub2-mkconfig -o {0}' and" + " 'grub2-install [block device, e.g. /dev/sda]'.".format(grub2_config_file), ) return diff --git a/convert2rhel/grub.py b/convert2rhel/grub.py index 67d2ef2a11..ce8f59bbc0 100644 --- a/convert2rhel/grub.py +++ b/convert2rhel/grub.py @@ -502,6 +502,8 @@ def get_grub_config_file(): """ grub_config_path = GRUB2_BIOS_CONFIG_FILE + # On RHEL 9 the path to the grub config file on UEFI has been unified with the one on BIOS. See: + # https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html-single/9.0_release_notes/index#enhancement_boot-loader if is_efi() and systeminfo.system_info.version.major < 9: grub_config_path = os.path.join(RHEL_EFIDIR_CANONICAL_PATH, "grub.cfg") diff --git a/convert2rhel/unit_tests/actions/post_conversion/update_grub_test.py b/convert2rhel/unit_tests/actions/post_conversion/update_grub_test.py index 0fd147e255..4d94eaedfe 100644 --- a/convert2rhel/unit_tests/actions/post_conversion/update_grub_test.py +++ b/convert2rhel/unit_tests/actions/post_conversion/update_grub_test.py @@ -102,13 +102,12 @@ def test_update_grub( id="GRUB2_CONFIG_CREATION_FAILED", title="The grub2-mkconfig call failed to complete", description=( - "The grub2-mkconfig call failed with output:\n'output'.\nThe conversion will continue but there" - " may be issues with the current grub2 config and image formats." + "There may be issues with the bootloader configuration." + " Follow the recommended remediation before rebooting the system." ), - diagnosis=None, - remediations="If there are issues with the current grub2 config and image we recommend manually " - "re-generating them with 'grub2-mkconfig -o /boot/grub2/grub.cfg' and" - "'grub2-install [block device, e.g. /dev/sda]'.", + diagnosis="The grub2-mkconfig call failed with output:\n'output'", + remediations="Resolve the problem reported in the diagnosis and then run 'grub2-mkconfig -o" + " /boot/grub2/grub.cfg' and 'grub2-install [block device, e.g. /dev/sda]'.", ), ) ), @@ -126,13 +125,12 @@ def test_update_grub( id="GRUB2_CONFIG_CREATION_FAILED", title="The grub2-mkconfig call failed to complete", description=( - "The grub2-mkconfig call failed with output:\n'output'.\nThe conversion will continue but there" - " may be issues with the current grub2 config and image formats." + "There may be issues with the bootloader configuration." + " Follow the recommended remediation before rebooting the system." ), - diagnosis=None, - remediations="If there are issues with the current grub2 config and image we recommend manually " - "re-generating them with 'grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg' and" - "'grub2-install [block device, e.g. /dev/sda]'.", + diagnosis="The grub2-mkconfig call failed with output:\n'output'", + remediations="Resolve the problem reported in the diagnosis and then run 'grub2-mkconfig -o" + " /boot/efi/EFI/redhat/grub.cfg' and 'grub2-install [block device, e.g. /dev/sda]'.", ), ) ), @@ -150,13 +148,12 @@ def test_update_grub( id="GRUB2_CONFIG_CREATION_FAILED", title="The grub2-mkconfig call failed to complete", description=( - "The grub2-mkconfig call failed with output:\n'output'.\nThe conversion will continue but there" - " may be issues with the current grub2 config and image formats." + "There may be issues with the bootloader configuration." + " Follow the recommended remediation before rebooting the system." ), - diagnosis=None, - remediations="If there are issues with the current grub2 config and image we recommend manually " - "re-generating them with 'grub2-mkconfig -o /boot/grub2/grub.cfg' and" - "'grub2-install [block device, e.g. /dev/sda]'.", + diagnosis="The grub2-mkconfig call failed with output:\n'output'", + remediations="Resolve the problem reported in the diagnosis and then run 'grub2-mkconfig -o" + " /boot/grub2/grub.cfg' and 'grub2-install [block device, e.g. /dev/sda]'.", ), ) ),