Class: Bootloader::AutoyastConverter

Inherits:
Object
  • Object
show all
Extended by:
Yast::Logger
Defined in:
src/lib/bootloader/autoyast_converter.rb

Overview

Converter between internal configuration model and autoyast serialization of configuration.

Constant Summary

Class Method Summary (collapse)

Class Method Details

+ (Object) export(config)



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'src/lib/bootloader/autoyast_converter.rb', line 39

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"] = {}
  global = res["global"]
  export_stage1(global, config.stage1) if config.respond_to?(:stage1)
  export_default(global, config.grub_default)

  res
end

+ (Object) import(data)



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'src/lib/bootloader/autoyast_converter.rb', line 24

def import(data)
  bootloader = bootloader_from_data(data)
  return bootloader if bootloader.name == "none"
  # let it be empty if not defined to keep code simplier as effect is same
  data["global"] ||= {}

  import_stage1(data, bootloader)
  import_default(data, bootloader)
  # TODO: import Initrd

  log.warn "autoyast profile contain sections which won't be processed" if data["sections"]

  bootloader
end