[PATCHv2] Provide a mechanism for platform-specific error messages for stage1 failure

Vratislav Podzimek vpodzime at redhat.com
Tue Jan 28 11:36:00 UTC 2014


On Tue, 2014-01-28 at 00:28 -0800, Adam Williamson wrote:
> This is a follow-up to "provide a more useful error message if user fails to
> create an ESP". It just implements the same thing in a better way: instead
> of stuffing a check for UEFI platform and a platform-specific error message
> into the storage sanity check, it provides a mechanism by which we can specify
> in platform.py an error message to be displayed in the case the stage1 check
> fails. _boot_stage1_missing_error for any platform in platform.py will always
> be shown to the user in the sanity check results if stage1_device setting
> failed.
> 
> I've only included a message for UEFI for now. I'm not familiar enough with the
> non-x86 platforms to write messages for those. For x86 BIOS mode, every case
> of this error I could find in the wild related to not creating a biosboot
> partition when installing to GPT, or some kind of flat-out anaconda bug.
> The sanity check already contains a special test for the biosboot partition,
> so any time you hit that case you already see a useful error message, there's
> no need to duplicate it.
> 
> I also slightly tweaked the text of the generic error message itself to be
> more accurate to the logic as it currently stands: stage1_device not being set
> doesn't necessarily mean "nothing and no-one tried to set it" any more, it can
> also mean "we tried to set it but couldn't find a valid setting" - in fact,
> that's much more likely.
> ---
>  blivet/__init__.py | 11 +++++------
>  blivet/platform.py |  3 +++
>  2 files changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/blivet/__init__.py b/blivet/__init__.py
> index e23ca3e..5b6243a 100644
> --- a/blivet/__init__.py
> +++ b/blivet/__init__.py
> @@ -1626,12 +1626,11 @@ class Blivet(object):
>          if self.bootloader and not self.bootloader.skip_bootloader:
>              stage1 = self.bootloader.stage1_device
>              if not stage1:
> -                errors.append(_("you have not created a bootloader stage1 "
> -                                "target device"))
> -                if arch.isEfi():
> -                    errors.append(_("For a UEFI installation, your layout must "
> -                                    "include an EFI system partition mounted at "
> -                                    "/boot/efi"))
> +                errors.append(_("No valid bootloader stage1 target device "
> +                                "found."))
> +                pe = _platform._boot_stage1_missing_error
It's a bit dirty to read object's internal attribute (starting with the
underscore) like this, but on the other hand the name has to match the
coding style of the other attributes. ACK.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list