Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Mar 29, 2019
1 parent 4ea5a9c commit de0d21d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 28 deletions.
6 changes: 4 additions & 2 deletions src/include/network/lan/address.rb
Expand Up @@ -55,7 +55,8 @@ def initialize_network_lan_address(include_target)
Yast.import "NetworkInterfaces"
Yast.import "Popup"
Yast.import "ProductFeatures"
Yast.import "Routing"
# TODO: network-ng
# Yast.import "Routing"
Yast.import "String"
Yast.import "Wizard"
Yast.import "Map"
Expand Down Expand Up @@ -1367,7 +1368,8 @@ def AddressDialog
# "No IP address" case, then default gw must stay (#460262)
# and also: don't delete default GW for usb/pcmcia devices (#307102)
if LanItems.isCurrentDHCP && !LanItems.isCurrentHotplug
Routing.RemoveDefaultGw
# TODO: network-ng
# Routing.RemoveDefaultGw
end
end

Expand Down
1 change: 0 additions & 1 deletion src/include/network/lan/complex.rb
Expand Up @@ -40,7 +40,6 @@ def initialize_network_lan_complex(include_target)
Yast.import "Mode"
Yast.import "NetworkConfig"
Yast.import "NetworkService"
Yast.import "Routing"
Yast.import "Wizard"
Yast.import "Popup"
Yast.import "Label"
Expand Down
11 changes: 7 additions & 4 deletions src/lib/network/edit_nic_name.rb
Expand Up @@ -6,7 +6,8 @@ module Yast
Yast.import "UI"
Yast.import "LanItems"
Yast.import "Popup"
Yast.import "Routing"
# TODO: network-ng
# Yast.import "Routing"

# The class represents a simple dialog which allows user to input new NIC
# name. It also allows to select a device attribute (MAC, Bus id, ...) which will
Expand Down Expand Up @@ -76,8 +77,9 @@ def run
LanItems.update_item_udev_rule!(udev_type)

if new_name != old_name
LanItems.update_routing_devices!
LanItems.update_routes!(old_name) if update_routes?(old_name)
# TODO: network-ng
# LanItems.update_routing_devices!
# LanItems.update_routes!(old_name) if update_routes?(old_name)
end
end

Expand Down Expand Up @@ -168,7 +170,8 @@ def CheckUdevNicName(name)
#
# return [Boolean] whether the routes have to be updated or not
def update_routes?(previous_name)
return false unless Routing.device_routes?(previous_name)
# TODO: network-ng
# return false unless Routing.device_routes?(previous_name)

Popup.YesNoHeadline(
Label.WarningMsg,
Expand Down
1 change: 0 additions & 1 deletion src/lib/network/network_autoyast.rb
Expand Up @@ -22,7 +22,6 @@ def initialize
Yast.import "LanItems"
Yast.import "Linuxrc"
Yast.import "Host"
Yast.import "Routing"
Yast.import "AutoInstall"
end

Expand Down
20 changes: 0 additions & 20 deletions src/modules/LanItems.rb
Expand Up @@ -58,7 +58,6 @@ def main
Yast.import "UI"
textdomain "network"

Yast.import "Routing"
Yast.import "NetworkInterfaces"
Yast.import "ProductFeatures"
Yast.import "NetworkConfig"
Expand Down Expand Up @@ -2662,25 +2661,6 @@ def colliding_item(name)
item_id
end

# Return wether the {Yast:Routing} devices list needs to be updated or not
# to include the current interface name
#
# @return [Boolean] false if the current interface name is already present
def update_routing_devices?
!Routing.devices.include?(current_name)
end

# Convenience method to update the {Yast::Routing} devices list
def update_routing_devices!
Routing.SetDevices(current_device_names)
end

# It modifies the interface name with the new one of all the routes
# that belongs to the current renamed {LanItem}
def update_routes!(previous_name)
Routing.device_routes(previous_name).each { |r| r["device"] = current_name }
end

private

# Checks if given lladdr can be written into ifcfg
Expand Down

0 comments on commit de0d21d

Please sign in to comment.