Module: Yast::NetworkHardwareInclude

Defined in:
src/include/network/hardware.rb

Instance Method Summary collapse

Instance Method Details

#FindHardware(hardware, which) ⇒ Object

Select the given hardware item or clean up structures (item == nil)


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'src/include/network/hardware.rb', line 46

def FindHardware(hardware, which)
  sel = {}

  if !which.nil?
    sel = Ops.get_map(hardware, which, {})

    if Ops.greater_than(which, Builtins.size(hardware)) ||
        Ops.less_than(which, 0)
      Builtins.y2error(
        "Item not found in Hardware: %1 (%2)",
        which,
        Builtins.size(hardware)
      )
    end
  end

  sel
end

#initialize_network_hardware(include_target) ⇒ Object


35
36
37
38
39
40
41
42
# File 'src/include/network/hardware.rb', line 35

def initialize_network_hardware(include_target)
  textdomain "network"

  Yast.import "Arch"
  Yast.import "Confirm"
  Yast.import "Map"
  Yast.include include_target, "network/routines.rb"
end

#SelectHardware(hardware, which) ⇒ Object

Select the given hardware item or clean up structures (item == nil)


95
96
97
# File 'src/include/network/hardware.rb', line 95

def SelectHardware(hardware, which)
  SelectHardwareMap(FindHardware(hardware, which))
end

#SelectHardwareMap(sel) ⇒ Object

Select the given hardware item SelectHardware is a "virtual method", that is named SelectHW in "subclasses" like Lan and Modem.


69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'src/include/network/hardware.rb', line 69

def SelectHardwareMap(sel)
  sel = deep_copy(sel)
  # common stuff
  @description = Ops.get_string(sel, "name", "")
  @type = Ops.get_string(sel, "type", "eth")
  @hotplug = Ops.get_string(sel, "hotplug", "")

  #    unique = sel["udi"]:"";
  @Requires = Ops.get_list(sel, "requires", [])
  # #44977: Requires now contain the appropriate kernel packages
  # but they are handled differently due to multiple kernel flavors
  # (see Package::InstallKernel)
  # Leave only those not starting with "kernel".
  @Requires = Builtins.filter(@Requires) do |r|
    Builtins.search(r, "kernel") != 0
  end
  Builtins.y2milestone("requires=%1", @Requires)

  # FIXME: devname
  @hotplug = ""

  deep_copy(sel)
end