Skip to content

Commit

Permalink
Fix the Lan#refresh_lan_items
Browse files Browse the repository at this point in the history
* Now it only refreshes the interfaces.
* Renamed to refresh_interfaces to make its intention clear.
  • Loading branch information
imobachgs committed Sep 19, 2019
1 parent bf3ac66 commit 8b527b2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/lib/y2network/interfaces_collection.rb
Expand Up @@ -19,6 +19,7 @@

require "yast"
require "y2network/interface"
require "y2network/can_be_copied"
require "forwardable"

module Y2Network
Expand All @@ -41,6 +42,7 @@ module Y2Network
class InterfacesCollection
extend Forwardable
include Yast::Logger
include CanBeCopied

# @return [Array<Interface>] List of interfaces
attr_reader :interfaces
Expand Down
16 changes: 10 additions & 6 deletions src/modules/Lan.rb
Expand Up @@ -870,7 +870,7 @@ def ProposeVirtualized
builder.configure_as_slave
builder.save
LanItems.move_routes(builder.name, bridge_builder.name)
refresh_lan_items
refresh_interfaces
end

nil
Expand Down Expand Up @@ -1044,12 +1044,16 @@ def connected_and_bridgeable?(bridge_builder, interface)
true
end

# Refreshes YaST network configuration
# Refreshes YaST network interfaces
#
# It does not modified the system configuration that was already read.
def refresh_lan_items
yast_config = Y2Network::Config.from(:sysconfig)
Yast::Lan.add_config(:yast, yast_config)
# It refreshes system configuration and update the list of interfaces
# for the current YaST configuration. The rest of the configuration
# is not modified.
#
# TODO: consider adding an API to Y2Network::Config to do partial refreshes.
def refresh_interfaces
system_config = Y2Network::Config.from(:sysconfig)
yast_config.interfaces = system_config.interfaces.copy
end

# Reads system configuration
Expand Down

0 comments on commit 8b527b2

Please sign in to comment.