Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package yast2-network for openSUSE:Factory checked in at 2022-02-11 23:06:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-network (Old) and /work/SRC/openSUSE:Factory/.yast2-network.new.1956 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-network" Fri Feb 11 23:06:38 2022 rev:473 rq:953285 version:4.4.39 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes 2022-02-09 20:39:17.418388925 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-network.new.1956/yast2-network.changes 2022-02-11 23:06:50.562511399 +0100 @@ -1,0 +2,15 @@ +Thu Feb 10 18:01:05 UTC 2022 - Knut Anderssen <kanders...@suse.com> + +- Related to (bsc#1194911) + - During installation skip the network configuration dialog when + network is configured with iBFT. +4.4.39 + +------------------------------------------------------------------- +Wed Feb 9 12:14:50 UTC 2022 - Knut Anderssen <kanders...@suse.com> + +- During installation, do not configure DHCP if there is some + active interface configured by iBFT (bsc#1194911) +- 4.4.38 + +------------------------------------------------------------------- Old: ---- yast2-network-4.4.37.tar.bz2 New: ---- yast2-network-4.4.39.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.lJ61pA/_old 2022-02-11 23:06:51.182513121 +0100 +++ /var/tmp/diff_new_pack.lJ61pA/_new 2022-02-11 23:06:51.190513143 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.4.37 +Version: 4.4.39 Release: 0 Summary: YaST2 - Network Configuration License: GPL-2.0-only ++++++ yast2-network-4.4.37.tar.bz2 -> yast2-network-4.4.39.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.37/package/yast2-network.changes new/yast2-network-4.4.39/package/yast2-network.changes --- old/yast2-network-4.4.37/package/yast2-network.changes 2022-02-07 20:23:46.000000000 +0100 +++ new/yast2-network-4.4.39/package/yast2-network.changes 2022-02-10 19:38:56.000000000 +0100 @@ -1,4 +1,19 @@ ------------------------------------------------------------------- +Thu Feb 10 18:01:05 UTC 2022 - Knut Anderssen <kanders...@suse.com> + +- Related to (bsc#1194911) + - During installation skip the network configuration dialog when + network is configured with iBFT. +4.4.39 + +------------------------------------------------------------------- +Wed Feb 9 12:14:50 UTC 2022 - Knut Anderssen <kanders...@suse.com> + +- During installation, do not configure DHCP if there is some + active interface configured by iBFT (bsc#1194911) +- 4.4.38 + +------------------------------------------------------------------- Fri Feb 4 15:14:10 UTC 2022 - Knut Anderssen <kanders...@suse.com> - Fixed interfaces overview help (bsc#1195155) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.37/package/yast2-network.spec new/yast2-network-4.4.39/package/yast2-network.spec --- old/yast2-network-4.4.37/package/yast2-network.spec 2022-02-07 20:23:46.000000000 +0100 +++ new/yast2-network-4.4.39/package/yast2-network.spec 2022-02-10 19:38:56.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.4.37 +Version: 4.4.39 Release: 0 Summary: YaST2 - Network Configuration License: GPL-2.0-only diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.37/src/lib/network/clients/inst_lan.rb new/yast2-network-4.4.39/src/lib/network/clients/inst_lan.rb --- old/yast2-network-4.4.37/src/lib/network/clients/inst_lan.rb 2022-02-07 20:23:46.000000000 +0100 +++ new/yast2-network-4.4.39/src/lib/network/clients/inst_lan.rb 2022-02-10 19:38:56.000000000 +0100 @@ -18,6 +18,7 @@ # find current contact information at www.suse.com. require "yast" +require "network/network_autoconfiguration" Yast.import "UI" Yast.import "Lan" @@ -99,9 +100,7 @@ # @return [Boolean] true when there is some connection present in yast # config; false otherwise def connections_configured? - # Ensure we read the current network config - Lan.Read(:cache) - !(Lan.yast_config&.connections || []).empty? + NetworkAutoconfiguration.instance.any_iface_active? end # It returns whether the network has been configured or not. It returns diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.37/src/lib/network/network_autoconfiguration.rb new/yast2-network-4.4.39/src/lib/network/network_autoconfiguration.rb --- old/yast2-network-4.4.37/src/lib/network/network_autoconfiguration.rb 2022-02-07 20:23:46.000000000 +0100 +++ new/yast2-network-4.4.39/src/lib/network/network_autoconfiguration.rb 2022-02-10 19:38:56.000000000 +0100 @@ -39,6 +39,8 @@ Yast.import "DNS" Yast.import "Arch" Yast.import "Host" + + Yast.include self, "network/routines.rb" # TODO: needed only for phy_connected end # Checks if any of available interfaces is configured and active @@ -46,24 +48,33 @@ # returns [Boolean] true when at least one interface is active def any_iface_active? Yast::Lan.Read(:cache) - config.interfaces.any? { |c| config.connections.by_name(c.name) && active_config?(c.name) } + config.interfaces.any? do |interface| + return false unless active_config?(interface.name) + + config.connections.by_name(interface.name) || ibft_interfaces.include?(interface.name) + end + end + + # Return true if the given interface is connected but it is not configured by iBFT or via an + # ifcfg file. + # + # Note: (it speeds up the initialization phase of installer - bnc#872319) + # @param interface [Y2Network::Interface] + # @return [Boolean] + def dhcp_candidate?(interface) + return false if config.connections.by_name(interface.name) + return false if ibft_interfaces.include?(interface.name) + + phy_connected?(interface.name) end def configure_dhcp Yast::Lan.Read(:cache) - Yast.include self, "network/routines.rb" # TODO: needed only for phy_connected - # find out network devices suitable for dhcp autoconfiguration. - # Such device has to: - # - be unconfigured - # - physically connected to a network - # (it speeds up the initialization phase of installer - bnc#872319) - dhcp_cards = config.interfaces.select do |c| - next false if config.connections.by_name(c.name) + dhcp_cards = config.interfaces.select { |i| dhcp_candidate?(i) } - phy_connected?(c.name) - end log.info "Candidates for enabling DHCP: #{dhcp_cards.inspect}" + return if dhcp_cards.empty? # TODO: time consuming, some progress would be nice dhcp_cards.each { |d| setup_dhcp(d) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.37/src/lib/network/wicked.rb new/yast2-network-4.4.39/src/lib/network/wicked.rb --- old/yast2-network-4.4.37/src/lib/network/wicked.rb 2022-02-07 20:23:46.000000000 +0100 +++ new/yast2-network-4.4.39/src/lib/network/wicked.rb 2022-02-10 19:38:56.000000000 +0100 @@ -18,12 +18,14 @@ # find current contact information at www.suse.com. require "yast" +require "yast2/execute" require "shellwords" module Yast module Wicked BASH_PATH = Path.new(".target.bash") BASH_OUTPUT_PATH = Path.new(".target.bash_output") + IBFT_CMD = "/etc/wicked/extensions/ibft".freeze # Reloads configuration for each device named in devs # @@ -76,5 +78,12 @@ stack + result.fetch("stdout", "").split("\n") end end + + # Returns an array of interface names which are configured using iBFT + # + # @return [Array <String>] array of interface names + def ibft_interfaces + Yast::Execute.stdout.locally!(IBFT_CMD, "-l").gsub("\n", " ").split(" ").uniq + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.37/test/inst_lan_test.rb new/yast2-network-4.4.39/test/inst_lan_test.rb --- old/yast2-network-4.4.37/test/inst_lan_test.rb 2022-02-07 20:23:46.000000000 +0100 +++ new/yast2-network-4.4.39/test/inst_lan_test.rb 2022-02-10 19:38:56.000000000 +0100 @@ -32,7 +32,13 @@ let(:going_back) { false } let(:using_nm) { false } let(:connections) { Y2Network::ConnectionConfigsCollection.new([]) } - let(:fake_conn) { instance_double("Y2Network::ConnectionConfig") } + let(:interfaces) { Y2Network::InterfacesCollection.new([eth0]) } + let(:connections) { Y2Network::ConnectionConfigsCollection.new([]) } + let(:eth0) { Y2Network::Interface.new("eth0") } + let(:eth0_conn) { Y2Network::ConnectionConfig::Ethernet.new.tap { |c| c.name = "eth0" } } + let(:config) do + Y2Network::Config.new(connections: connections, interfaces: interfaces, source: :testing) + end before do allow(Yast::GetInstArgs).to receive(:argmap).and_return(argmap) @@ -87,19 +93,22 @@ subject.main end - context "and there is some connection config already present in yast" do - let(:connections) { Y2Network::ConnectionConfigsCollection.new([fake_conn]) } - let(:config) { instance_double("Y2Network::Config", connections: connections) } - + context "and there is some active network configuration" do it "does not run the network configuration sequence" do + expect(Yast::NetworkAutoconfiguration.instance) + .to receive(:any_iface_active?).and_return(true) expect(subject).to_not receive(:LanSequence) subject.main end + end context "and the network is unconfigured" do it "runs the network configuration sequence" do + expect(Yast::NetworkAutoconfiguration.instance) + .to receive(:any_iface_active?).and_return(false) + expect(subject).to receive(:LanSequence) subject.main end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.37/test/network_autoconfiguration_test.rb new/yast2-network-4.4.39/test/network_autoconfiguration_test.rb --- old/yast2-network-4.4.37/test/network_autoconfiguration_test.rb 2022-02-07 20:23:46.000000000 +0100 +++ new/yast2-network-4.4.39/test/network_autoconfiguration_test.rb 2022-02-10 19:38:56.000000000 +0100 @@ -23,12 +23,11 @@ require "yast" require "network/network_autoconfiguration" +require "y2network/virtual_interface" require "y2network/routing" require "y2network/routing_table" require "y2network/route" -Yast.import "NetworkInterfaces" - # @return one item for a .probe.netcard list def probe_netcard_factory(num) num = num.to_s @@ -66,7 +65,14 @@ end describe Yast::NetworkAutoconfiguration do - let(:yast_config) { Y2Network::Config.new(source: :wicked) } + let(:yast_config) do + Y2Network::Config.new(interfaces: interfaces, connections: connections, source: :source) + end + let(:eth0) { Y2Network::Interface.new("eth0") } + let(:interfaces) { Y2Network::InterfacesCollection.new([eth0]) } + let(:connections) { Y2Network::ConnectionConfigsCollection.new([eth0_conn]) } + let(:eth0_conn) { Y2Network::ConnectionConfig::Ethernet.new.tap { |c| c.name = eth0.name } } + let(:source) { :wicked } let(:system_config) { yast_config.copy } let(:instance) { Yast::NetworkAutoconfiguration.instance } @@ -74,89 +80,148 @@ Y2Network::Config.add(:yast, yast_config) Y2Network::Config.add(:system, system_config) allow(Yast::Lan).to receive(:Read) + allow(Yast::Lan).to receive(:read_config) allow(Yast::Lan).to receive(:write_config) end - describe "it sets DHCLIENT_SET_DEFAULT_ROUTE properly" do - let(:network_interfaces) { double("NetworkInterfaces") } + describe "#any_iface_active?" do + let(:active) { false } + let(:ibft_interfaces) { [] } + + before do + allow(instance).to receive(:active_config?).with("eth0").and_return(active) + allow(instance).to receive(:ibft_interfaces).and_return(ibft_interfaces) + end + + it "returns false if the interface state is not UP" do + expect(instance.any_iface_active?).to be false + end + + context "when the interface state is UP" do + let(:active) { true } + + context "and the interface is configured through iBFT" do + let(:ibft_interfaces) { [eth0.name] } + + it "returns true" do + expect(instance.any_iface_active?).to be true + end + end + + context "and the interface has a configuration file" do + it "returns true" do + expect(instance.any_iface_active?).to be true + end + end + + context "but the interface is not configured" do + let(:connections) { Y2Network::ConnectionConfigsCollection.new([]) } - before(:each) do - # stub NetworkInterfaces, apart from the ifcfgs - allow(Yast::NetworkInterfaces) - .to receive(:CleanHotplugSymlink) - allow(Yast::NetworkInterfaces) - .to receive(:adapt_old_config!) - allow(Yast::NetworkInterfaces) - .to receive(:GetTypeFromSysfs). with(/eth\d+/). and_return "eth" - allow(Yast::NetworkInterfaces) - .to receive(:GetType). with(/eth\d+/). and_return "eth" - allow(Yast::NetworkInterfaces) - .to receive(:GetType). with(""). and_return nil - Yast::NetworkInterfaces.instance_variable_set(:@initialized, false) - - # stub program execution - # - interfaces are up - allow(Yast::SCR) - .to receive(:Execute) - .with(path(".target.bash"), /^\/usr\/sbin\/wicked ifstatus/) - .and_return 0 - # - reload works - allow(Yast::SCR) - .to receive(:Execute) - .with(path(".target.bash"), /^\/usr\/sbin\/wicked ifreload/) - .and_return 0 - # - ping works - allow(Yast::SCR) - .to receive(:Execute) - .with(path(".target.bash"), /^\/usr\/bin\/ping/) - .and_return 0 - - # These "expect" should be "allow", but then it does not work out, - # because SCR multiplexes too much and the matchers get confused. - - # Hardware detection - allow(Yast::SCR) - .to receive(:Read) - .with(path(".probe.netcard")) - .and_return([probe_netcard_factory(0), probe_netcard_factory(1)]) - - # link status - allow(Yast::SCR) - .to receive(:Read) - .with(path(".target.string"), %r{/sys/class/net/.*/carrier}) - .twice - .and_return "1" - - # miscellaneous uninteresting but hard to avoid stuff - - allow(Yast::Arch).to receive(:architecture).and_return "x86_64" - allow(Yast::Confirm).to receive(:Detection).and_return true - allow(Yast::NetworkInterfaces).to receive(:Write).and_call_original - end - - it "configures just one NIC to have a default route" do - expect { instance.configure_dhcp }.to_not raise_error - # TODO: write it when we can set up dhcp default route + it "returns false" do + expect(instance.any_iface_active?).to be false + end + end end end - describe "#any_iface_active?" do - IFACE = "eth0".freeze + describe "#dhcp_candidate?" do + let(:ibft_interfaces) { [] } + let(:connected) { true } + let(:connections) { Y2Network::ConnectionConfigsCollection.new([]) } + + before do + allow(instance).to receive(:ibft_interfaces).and_return(ibft_interfaces) + allow(instance).to receive(:phy_connected?).with(eth0.name).and_return(connected) + end - it "returns true if any of available interfaces has configuration and is up" do - allow(Yast::Lan).to receive(:yast_config) - .and_return( - Y2Network::Config.new( - interfaces: Y2Network::InterfacesCollection.new([double(name: IFACE)]), - connections: Y2Network::ConnectionConfigsCollection.new([double(name: IFACE)]), - source: :testing - ) - ) - allow(Yast::SCR) - .to receive(:Execute) - .and_return(0) + context "when the given interface has a config file" do + let(:connections) { Y2Network::ConnectionConfigsCollection.new([eth0_conn]) } - expect(instance.any_iface_active?).to be true + it "returns false" do + expect(instance.dhcp_candidate?(eth0)).to eql(false) + end + end + + context "when the given interface is configured by iBFT" do + let(:ibft_interfaces) { [eth0.name] } + + it "returns false" do + expect(instance.dhcp_candidate?(eth0)).to eql(false) + end + end + + context "when the interface is not configured" do + context "and it is not connected" do + let(:connected) { false } + + it "returns false" do + expect(instance.dhcp_candidate?(eth0)).to eql(false) + end + end + + context "and it is connected" do + it "returns true" do + expect(instance.dhcp_candidate?(eth0)).to eql(true) + end + end + end + end + + describe "#configure_dhcp" do + before do + allow(instance).to receive(:dhcp_candidate?).and_return(false) + allow(instance).to receive(:setup_dhcp) + allow(instance).to receive(:activate_changes) + allow(instance).to receive(:set_default_route_flag) + allow(instance).to receive(:set_default_route_flag_if_wan_dev?) + end + + it "reads the network configuration in case it was not cached" do + expect(Yast::Lan).to receive(:Read).with(:cache) + expect(instance.configure_dhcp) + end + + it "obtains a list of interfaces which are candidates to be configured by dhcp" do + expect(instance).to receive(:dhcp_candidate?).with(eth0).and_return(true) + expect(instance.configure_dhcp) + end + + context "when there is no candidate to setup" do + it "returns whitout doing changes to the config" do + expect(instance).to_not receive(:activate_changes) + expect(instance.configure_dhcp) + end + end + + context "when there is some candidate to setup" do + before do + allow(instance).to receive(:dhcp_candidate?).with(eth0).and_return(true) + end + + it "creates a DHCP configuration for the candidate interfaces" do + expect(instance).to receive(:setup_dhcp).with(eth0) + instance.configure_dhcp + end + + it "applies the new configuration changes" do + expect(instance).to receive(:activate_changes).with([eth0.name]) + instance.configure_dhcp + end + + context "if some of the new configured interfaces do not get a DHCP lease" do + it "deletes the configuration of the inactive devices" do + expect(instance).to receive(:activate_changes).with([eth0.name]) + expect(instance).to receive(:active_config?).with(eth0.name).and_return(false) + expect(instance).to receive(:delete_config).with(eth0) + instance.configure_dhcp + end + end + + it "configures just one NIC to have a default route" do + expect(instance).to receive(:active_config?).with(eth0.name).and_return(true) + expect(instance).to receive(:set_default_route_flag).with(eth0, "yes") + instance.configure_dhcp + end end end @@ -218,7 +283,6 @@ expect(instance.virtual_proposal_required?).to eql(true) end end - end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.37/test/wicked_test.rb new/yast2-network-4.4.39/test/wicked_test.rb --- old/yast2-network-4.4.37/test/wicked_test.rb 2022-02-07 20:23:46.000000000 +0100 +++ new/yast2-network-4.4.39/test/wicked_test.rb 2022-02-10 19:38:56.000000000 +0100 @@ -64,4 +64,17 @@ expect(subject.parse_ntp_servers("eth0")).to eq(["10.100.2.10", "10.100.2.11", "10.100.2.12"]) end end + + describe "#ibft_interfaces" do + let(:stdout) { instance_double("Yast::Execute") } + + before do + allow(Yast::Execute).to receive(:stdout).and_return(stdout) + allow(stdout).to receive(:locally!).and_return("eth0.42 eth0\neth0.42 eth0\neth1") + end + + it "returns an array of the interfaces configured by iBFT using the wicked iBFT extension" do + expect(subject.ibft_interfaces).to eql(["eth0.42", "eth0", "eth1"]) + end + end end