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


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
87
# File 'src/include/network/lan/address.rb', line 59

def AddressDialog(builder:)
  @builder = builder

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

  if ret != :back && ret != :abort
    if LanItems.isCurrentDHCP && !LanItems.isCurrentHotplug
      # 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)
      yast_config = Y2Network::Config.find(:yast)
      if yast_config && yast_config.routing && 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
    end
  end

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

#initialize_network_lan_address(include_target) ⇒ Object


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

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