Skip to content

Commit

Permalink
Additional grub2 config failure msg tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
bocekm committed Dec 2, 2024
1 parent a2d89f4 commit 6a69cd2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
12 changes: 5 additions & 7 deletions convert2rhel/actions/post_conversion/update_grub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions convert2rhel/grub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
33 changes: 15 additions & 18 deletions convert2rhel/unit_tests/actions/post_conversion/update_grub_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]'.",
),
)
),
Expand All @@ -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]'.",
),
)
),
Expand All @@ -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]'.",
),
)
),
Expand Down

0 comments on commit 6a69cd2

Please sign in to comment.