Skip to content

Commit

Permalink
Merge pull request #1280 from mchf/no_slaves_work_in_cli
Browse files Browse the repository at this point in the history
None slaves work in cli animore
  • Loading branch information
mchf committed Feb 2, 2022
2 parents 1987030 + f0372ec commit 3406883
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 7 deletions.
9 changes: 9 additions & 0 deletions package/yast2-network.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Tue Feb 1 06:28:14 UTC 2022 - Michal Filka <mfilka@suse.com>

- jsc#SLE-22015
- renamed slaves CLI option to conform to inclusive naming:
yast lan add name=bond0 bond_ports=eth0 eth1 bootproto=dhcp
- the "slaves=" option stays for backward compatibility
- 4.4.36

-------------------------------------------------------------------
Wed Jan 26 08:59:57 UTC 2022 - Michal Filka <mfilka@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-network.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-network
Version: 4.4.35
Version: 4.4.36
Release: 0
Summary: YaST2 - Network Configuration
License: GPL-2.0-only
Expand Down
13 changes: 11 additions & 2 deletions src/clients/lan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def main
"example" => [
"yast lan add name=vlan50 ethdevice=eth0 bootproto=dhcp",
"yast lan add name=br0 bridge_ports=eth0 eth1 bootproot=dhcp",
"yast lan add name=bond0 slaves=eth0 eth1 bootproto=dhcp",
"yast lan add name=bond0 bond_ports=eth0 eth1 bootproto=dhcp",
"yast lan add name=dummy0 type=dummy ip=10.0.0.100"
]
},
Expand Down Expand Up @@ -155,11 +155,19 @@ def main
"help" => _("Prefix length"),
"type" => "string"
},
"slaves" => {
"bond_ports" => {
# Commandline option help
"help" => _("Bond Ports"),
"type" => "string"
},
"slaves" => {
# Commandline option help
# TRANSLATORS: slaves is old option for configuring bond ports. User
# should be notified that the option is obsolete and bond_ports should
# be used instead
"help" => _("Bond Ports (obsolete, use bond_ports instead)"),
"type" => "string"
},
"ethdevice" => {
# Commandline option help
"help" => _("Ethernet Device for VLAN"),
Expand All @@ -185,6 +193,7 @@ def main
"ip",
"netmask",
"prefix",
"bond_ports",
"slaves",
"type",
"ethdevice",
Expand Down
10 changes: 8 additions & 2 deletions src/include/network/lan/cmdline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ def ListHandler(options)
# Handler for action "add"
# @param [Hash{String => String}] options action options
def AddHandler(options)
# slaves option is marked as obsolete, bond_ports should be used instead.
# If both options are present, new one (bond_ports) wins.
if !options.key?("bond_ports") && options.key?("slaves")
options["bond_ports"] = options.delete("slaves")
end

type = options.fetch("type", infered_type(options))
if type.empty?
Report.Error(_("The device type is mandatory."))
Expand Down Expand Up @@ -172,7 +178,7 @@ def DeleteHandler(options)
# @param options [Hash{String => String}] action options
# @return [String] infered device type; an empty string if not infered
def infered_type(options)
return "bond" if options.include? "slaves"
return "bond" if options.include? "bond_ports"
return "vlan" if options.include? "ethdevice"
return "br" if options.include? "bridge_ports"

Expand Down Expand Up @@ -206,7 +212,7 @@ def update_builder_from_options!(builder, options)
case builder.type.short_name
when "bond"
# change only if user specify it
builder.ports = options["slaves"].split(" ") if options["slaves"]
builder.ports = options["bond_ports"].split(" ") if options["bond_ports"]
when "vlan"
# change only if user specify it
builder.etherdevice = options["ethdevice"] if options["ethdevice"]
Expand Down
2 changes: 1 addition & 1 deletion test/network_autoconfiguration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def probe_netcard_factory(num)
end

context "and the routing config was modified" do
it "moves the routes from the enslaved interface to the bridge" do
it "moves the routes from the bridge port to the bridge" do
expect { instance.configure_virtuals }.to change { route.interface }.from(eth5).to(br0)
end

Expand Down
2 changes: 1 addition & 1 deletion test/y2network/widgets/bridge_ports_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
end
end

context "when some of the enslaved interfaces are configured" do
context "when some of the bridged interfaces are configured" do
it "warns the user and request confirmation to continue" do
allow(builder).to receive(:require_adaptation?).and_return(true)

Expand Down

0 comments on commit 3406883

Please sign in to comment.