Module: Yast::NetworkLanAddressInclude

Includes:
Y2Firewall::Helpers::Interfaces, I18n, Logger
Defined in:
src/include/network/lan/address.rb

Instance Method Summary collapse

Instance Method Details

#AddressDialog(builder:) ⇒ Object

Dialog for setting up IP address

Returns:

  • dialog result



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'src/include/network/lan/address.rb', line 57

def AddressDialog(builder:)
  ret = Y2Network::Dialogs::EditInterface.run(builder)

  log.info "AddressDialog res: #{ret.inspect}"

  return ret if [:back, :abort].include?(ret)
  return ret if builder.interface&.hotplug? || !builder.boot_protocol.dhcp?

  # fixed bug #73739 - if dhcp is used, dont set default gw statically
  # but also: reset default gw only if DHCP* is used, this branch covers
  #     "No IP address" case, then default gw must stay (#460262)
  # and also: don't delete default GW for usb/pcmcia devices (#307102)
  #
  # Is check for hotplug really needed? It contained a typo up to SLE-15-SP4 and
  # nobody complained - something to think of during next refactoring.
  yast_config = Y2Network::Config.find(:yast)
  if yast_config&.routing&.default_route
    remove_gw = Popup.YesNo(
      _(
        "A static default route is defined.\n" \
        "It is suggested to remove the static default route definition \n" \
        "if one can be obtained also via DHCP.\n" \
        "Do you want to remove the static default route?"
      )
    )
    yast_config.routing.remove_default_routes if remove_gw
  end

  ret
end

#initialize_network_lan_address(include_target) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'src/include/network/lan/address.rb', line 37

def initialize_network_lan_address(include_target)
  Yast.import "UI"

  textdomain "network"

  Yast.import "ProductFeatures"

  Yast.include include_target, "network/lan/help.rb"
  Yast.include include_target, "network/lan/hardware.rb"
  Yast.include include_target, "network/complex.rb"
  Yast.include include_target, "network/lan/s390.rb"

  @force_static_ip = ProductFeatures.GetBooleanFeature(
    "network",
    "force_static_ip"
  )
end