Module: Yast::NetworkHardwareInclude

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) FindHardware(_Hardware, which)

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

Parameters:

  • which (Fixnum)

    item to be chosen



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)
  _Hardware = deep_copy(_Hardware)
  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
  deep_copy(sel)
end

- (Object) initialize_network_hardware(include_target)



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

- (Object) SelectHardware(_Hardware, which)

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

Parameters:

  • which (Fixnum)

    item to be chosen



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

def SelectHardware(_Hardware, which)
  _Hardware = deep_copy(_Hardware)
  SelectHardwareMap(FindHardware(_Hardware, which))
end

- (Object) SelectHardwareMap(sel)

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

Parameters:

  • sel (Hash)

    item to be chosen



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