Skip to content

Commit

Permalink
warn when autoyast have wrong loader type
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed May 3, 2018
1 parent aaac72e commit c87e314
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/lib/bootloader/auto_client.rb
Expand Up @@ -3,8 +3,10 @@
require "installation/auto_client"
require "bootloader/bootloader_factory"
require "bootloader/autoyast_converter"
require "bootloader/exceptions"
require "bootloader/main_dialog"

Yast.import "AutoInstall"
Yast.import "Bootloader"
Yast.import "BootStorage"
Yast.import "Initrd"
Expand All @@ -27,7 +29,18 @@ def run
end

def import(data)
Yast::Bootloader.Import(data)
begin
Yast::Bootloader.Import(data)
rescue Bootloader::UnsupportedBootloader => e
possible_values = BootloaderFactory.supported_names + ["default"]
AutoInstall.issues_list.add(:invalid_value, "bootloader", "loader_type",
e.bootloader_name,
_("Bootloader is not supported on this architecture. Possible values: ") +
possible_values.join(", "),
:fatal
)
return false
end

Yast::PackagesProposal.AddResolvables("yast2-bootloader",
:package, BootloaderFactory.current.packages)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/bootloader/autoyast_converter.rb
Expand Up @@ -178,7 +178,7 @@ def import_custom_devices(data, stage1)

def bootloader_from_data(data)
loader_type = data["loader_type"] || "default"
allowed = BootloaderFactory::SUPPORTED_BOOTLOADERS + ["default"]
allowed = BootloaderFactory.supported_names + ["default"]

raise UnsupportedBootloader, loader_type if !allowed.include?(loader_type)

Expand Down

0 comments on commit c87e314

Please sign in to comment.