Skip to content

Commit

Permalink
Ensure ifcfg name is present.
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Feb 19, 2018
1 parent 941ca7d commit b7f4fdb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/modules/Lan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -862,12 +862,12 @@ def ProposeVirtualized
# then each configuration (except bridges) move to the bridge
# and add old device name into bridge_ports
LanItems.Items.each do |current, config|
ifcfg = config["ifcfg"].to_s
bridge_name = format("br%s", NetworkInterfaces.GetFreeDevice("br"))
next unless connected_and_bridgeable?(bridge_name, current, config)
LanItems.current = current
# first configure all connected unconfigured devices with dhcp (with default parameters)
LanItems.ProposeItem if !LanItems.IsCurrentConfigured
next if !LanItems.IsCurrentConfigured && !LanItems.ProposeItem
ifcfg = LanItems.GetCurrentName
next unless configure_as_bridge!(ifcfg, bridge_name)
# reconfigure existing device as newly created bridge's port
configure_as_bridge_port(ifcfg)
Expand Down Expand Up @@ -1035,7 +1035,7 @@ def connected_and_bridgeable?(bridge_name, item, config)
end

hwinfo = config.fetch("hwinfo", {})
if hwinfo.fetch("link", false) == true
unless hwinfo.fetch("link", false) == true
log.warn("Lan item #{item} has link:false detected")
return false
end
Expand Down
2 changes: 2 additions & 0 deletions test/lan_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,10 @@ def expect_modification_succeedes(modname, method)
before do
allow(Yast::NetworkInterfaces).to receive(:GetFreeDevice).with("br").and_return("1")
allow(Yast::LanItems).to receive(:IsCurrentConfigured).and_return(true)
allow(Yast::Lan).to receive(:ProposeItem)
allow(Yast::Lan).to receive(:configure_as_bridge!)
allow(Yast::Lan).to receive(:configure_as_bridge_port)
allow(Yast::Lan).to receive(:refresh_lan_items)

allow(Yast::LanItems).to receive(:Items)
.and_return(
Expand Down

0 comments on commit b7f4fdb

Please sign in to comment.