From 5005ff6184ec20545d8916855f4674a1cafc3820 Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Wed, 8 Sep 2021 17:17:10 +0200 Subject: [PATCH] internal: mandate installation device for the simplified installer Signed-off-by: Antonio Murdaca --- internal/blueprint/customizations.go | 3 +-- internal/distro/rhel86/distro.go | 3 +++ internal/distro/rhel90/distro.go | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/blueprint/customizations.go b/internal/blueprint/customizations.go index 58ace04ad..1d4b443c9 100644 --- a/internal/blueprint/customizations.go +++ b/internal/blueprint/customizations.go @@ -332,9 +332,8 @@ func (c *Customizations) GetFilesystemsMinSize() uint64 { } func (c *Customizations) GetInstallationDevice() string { - defaultDevice := "/dev/sda" if c == nil || c.InstallationDevice == "" { - return defaultDevice + return "" } return c.InstallationDevice } diff --git a/internal/distro/rhel86/distro.go b/internal/distro/rhel86/distro.go index 408cd71ad..c3a3688f8 100644 --- a/internal/distro/rhel86/distro.go +++ b/internal/distro/rhel86/distro.go @@ -461,6 +461,9 @@ func (t *imageType) checkOptions(customizations *blueprint.Customizations, optio if err := customizations.CheckAllowed("InstallationDevice"); err != nil { return fmt.Errorf("boot ISO image type %q contains unsupported blueprint customizations: %v", t.name, err) } + if customizations.GetInstallationDevice() == "" { + return fmt.Errorf("boot ISO image type %q requires specifying an installation device to install to", t.name) + } } else if customizations != nil { return fmt.Errorf("boot ISO image type %q does not support blueprint customizations", t.name) } diff --git a/internal/distro/rhel90/distro.go b/internal/distro/rhel90/distro.go index ac02c2f81..8d64dd234 100644 --- a/internal/distro/rhel90/distro.go +++ b/internal/distro/rhel90/distro.go @@ -461,6 +461,9 @@ func (t *imageType) checkOptions(customizations *blueprint.Customizations, optio if err := customizations.CheckAllowed("InstallationDevice"); err != nil { return fmt.Errorf("boot ISO image type %q contains unsupported blueprint customizations: %v", t.name, err) } + if customizations.GetInstallationDevice() == "" { + return fmt.Errorf("boot ISO image type %q requires specifying an installation device to install to", t.name) + } } else if customizations != nil { return fmt.Errorf("boot ISO image type %q does not support blueprint customizations", t.name) }