Class: Bootloader::AutoyastConverter
- Inherits:
-
Object
- Object
- Bootloader::AutoyastConverter
- Extended by:
- Yast::Logger
- Defined in:
- src/lib/bootloader/autoyast_converter.rb
Overview
Converter between internal configuration model and autoyast serialization of configuration. rubocop:disable Metrics/ClassLength converting autoyast profiles is just a lot of data
Class Method Summary collapse
-
.export(config) ⇒ Object
FIXME: use AutoinstProfile classes.
- .import(data) ⇒ Object
Class Method Details
.export(config) ⇒ Object
FIXME: use AutoinstProfile classes
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'src/lib/bootloader/autoyast_converter.rb', line 64 def export(config) log.info "exporting config #{config.inspect}" bootloader_type = config.name res = { "loader_type" => bootloader_type } return res if bootloader_type == "none" res["global"] = {} case config.name when "grub2", "grub2-efi" global = res["global"] export_grub2(global, config) if config.name == "grub2" export_grub2efi(global, config) if config.name == "grub2-efi" export_default(global, config.grub_default) export_password(global, config.password) res["global"]["cpu_mitigations"] = config.cpu_mitigations.value.to_s when "systemd-boot" res["global"]["timeout"] = config. res["global"]["secure_boot"] = config.secure_boot else raise UnsupportedBootloader, bootloader.name end # Do not export device map as device name are very unpredictable and is used only as # work-around when automatic ones do not work for what-ever reasons ( it can really safe # your day in L3 ) res end |
.import(data) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'src/lib/bootloader/autoyast_converter.rb', line 30 def import(data) log.info "import data #{data.inspect}" bootloader = bootloader_from_data(data) return bootloader if bootloader.name == "none" case bootloader.name when "grub2", "grub2-efi" import_grub2(data, bootloader) import_grub2efi(data, bootloader) import_stage1(data, bootloader) import_default(data, bootloader.grub_default) import_device_map(data, bootloader) import_password(data, bootloader) # always nil pmbr as autoyast does not support it yet, # so use nil to always use proposed value (bsc#1081967) bootloader.pmbr_action = nil cpu_mitigations = data.global.cpu_mitigations if cpu_mitigations bootloader.cpu_mitigations = CpuMitigations.from_string(cpu_mitigations) end when "systemd-boot" bootloader. = data.global.timeout bootloader.secure_boot = data.global.secure_boot else raise UnsupportedBootloader, bootloader.name end # TODO: import Initrd log.warn "autoyast profile contain sections which won't be processed" if data.sections bootloader end |