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 2021-06-01 10:33:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-network (Old) and /work/SRC/openSUSE:Factory/.yast2-network.new.1898 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-network" Tue Jun 1 10:33:46 2021 rev:454 rq:896337 version:4.4.12 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes 2021-05-15 23:17:00.164545081 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-network.new.1898/yast2-network.changes 2021-06-01 10:33:59.316458259 +0200 @@ -1,0 +2,14 @@ +Fri May 28 13:51:57 UTC 2021 - Knut Anderssen <kanders...@suse.com> + +- Allow to modify the network IP forwarding configuration defining + the defaults in the control file (bsc#1186280) +- 4.4.12 + +------------------------------------------------------------------- +Mon May 24 10:47:46 UTC 2021 - Knut Anderssen <kanders...@suse.com> + +- Fix error when determining the removed interfaces in order to + remove their associated routes too (bsc#1186082) +- 4.4.11 + +------------------------------------------------------------------- Old: ---- yast2-network-4.4.10.tar.bz2 New: ---- yast2-network-4.4.12.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.XVqhlE/_old 2021-06-01 10:33:59.848459165 +0200 +++ /var/tmp/diff_new_pack.XVqhlE/_new 2021-06-01 10:33:59.852459172 +0200 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.4.10 +Version: 4.4.12 Release: 0 Summary: YaST2 - Network Configuration License: GPL-2.0-only ++++++ yast2-network-4.4.10.tar.bz2 -> yast2-network-4.4.12.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.10/package/yast2-network.changes new/yast2-network-4.4.12/package/yast2-network.changes --- old/yast2-network-4.4.10/package/yast2-network.changes 2021-05-13 11:44:11.000000000 +0200 +++ new/yast2-network-4.4.12/package/yast2-network.changes 2021-05-31 12:26:49.000000000 +0200 @@ -1,4 +1,18 @@ ------------------------------------------------------------------- +Fri May 28 13:51:57 UTC 2021 - Knut Anderssen <kanders...@suse.com> + +- Allow to modify the network IP forwarding configuration defining + the defaults in the control file (bsc#1186280) +- 4.4.12 + +------------------------------------------------------------------- +Mon May 24 10:47:46 UTC 2021 - Knut Anderssen <kanders...@suse.com> + +- Fix error when determining the removed interfaces in order to + remove their associated routes too (bsc#1186082) +- 4.4.11 + +------------------------------------------------------------------- Wed May 12 16:46:00 UTC 2021 - Knut Anderssen <kanders...@suse.com> - Write IP addresses in order preventing an alias to set the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.10/package/yast2-network.spec new/yast2-network-4.4.12/package/yast2-network.spec --- old/yast2-network-4.4.10/package/yast2-network.spec 2021-05-13 11:44:11.000000000 +0200 +++ new/yast2-network-4.4.12/package/yast2-network.spec 2021-05-31 12:26:49.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.4.10 +Version: 4.4.12 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.10/src/lib/network/clients/network_proposal.rb new/yast2-network-4.4.12/src/lib/network/clients/network_proposal.rb --- old/yast2-network-4.4.10/src/lib/network/clients/network_proposal.rb 2021-05-13 11:44:11.000000000 +0200 +++ new/yast2-network-4.4.12/src/lib/network/clients/network_proposal.rb 2021-05-31 12:26:49.000000000 +0200 @@ -46,6 +46,7 @@ textdomain "installation" settings.refresh_packages + settings.apply_defaults end def description diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.10/src/lib/network/clients/save_network.rb new/yast2-network-4.4.12/src/lib/network/clients/save_network.rb --- old/yast2-network-4.4.10/src/lib/network/clients/save_network.rb 2021-05-13 11:44:11.000000000 +0200 +++ new/yast2-network-4.4.12/src/lib/network/clients/save_network.rb 2021-05-31 12:26:49.000000000 +0200 @@ -296,6 +296,7 @@ if !Mode.autoinst NetworkAutoconfiguration.instance.configure_dns + NetworkAutoconfiguration.instance.configure_routing configure_network_manager end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.10/src/lib/network/network_autoconfiguration.rb new/yast2-network-4.4.12/src/lib/network/network_autoconfiguration.rb --- old/yast2-network-4.4.10/src/lib/network/network_autoconfiguration.rb 2021-05-13 11:44:11.000000000 +0200 +++ new/yast2-network-4.4.12/src/lib/network/network_autoconfiguration.rb 2021-05-31 12:26:49.000000000 +0200 @@ -147,6 +147,12 @@ Host.Write end + def configure_routing + return if config.routing == Lan.system_config.routing + + Lan.write_config(only: [:routing]) + end + private # Makes DHCP setup persistent @@ -175,7 +181,7 @@ # @param devnames [Array] list of device names # @return true when changes were successfully applied def activate_changes(devnames) - Lan.write_config + Lan.write_config(only: [:connections]) reload_config(devnames) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.10/src/lib/y2network/autoinst_profile/routing_section.rb new/yast2-network-4.4.12/src/lib/y2network/autoinst_profile/routing_section.rb --- old/yast2-network-4.4.10/src/lib/y2network/autoinst_profile/routing_section.rb 2021-05-13 11:44:11.000000000 +0200 +++ new/yast2-network-4.4.12/src/lib/y2network/autoinst_profile/routing_section.rb 2021-05-31 12:26:49.000000000 +0200 @@ -82,8 +82,8 @@ def init_from_hashes(hash) super ip_forward = hash["ip_forward"] - @ipv4_forward = hash["ipv4_forward"] || ip_forward - @ipv6_forward = hash["ipv6_forward"] || ip_forward + @ipv4_forward = hash.fetch("ipv4_forward", ip_forward) + @ipv6_forward = hash.fetch("ipv6_forward", ip_forward) @routes = routes_from_hash(hash) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.10/src/lib/y2network/interface.rb new/yast2-network-4.4.12/src/lib/y2network/interface.rb --- old/yast2-network-4.4.10/src/lib/y2network/interface.rb 2021-05-13 11:44:11.000000000 +0200 +++ new/yast2-network-4.4.12/src/lib/y2network/interface.rb 2021-05-31 12:26:49.000000000 +0200 @@ -95,6 +95,11 @@ # https://ruby-doc.org/core-2.3.3/Object.html#method-i-eql-3F alias_method :eql?, :== + # Used by Array or Hash in order to compare equality of elements (bsc#1186082) + def hash + name.hash + end + # Complete configuration of the interface # # @return [Hash<String, String>] option, value hash map diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.10/src/lib/y2network/interfaces_collection.rb new/yast2-network-4.4.12/src/lib/y2network/interfaces_collection.rb --- old/yast2-network-4.4.10/src/lib/y2network/interfaces_collection.rb 2021-05-13 11:44:11.000000000 +0200 +++ new/yast2-network-4.4.12/src/lib/y2network/interfaces_collection.rb 2021-05-31 12:26:49.000000000 +0200 @@ -150,5 +150,13 @@ def +(other) self.class.new(to_a + other.to_a) end + + # Returns a new collection including only the elements that are not in the given collection + # + # @param other [InterfacesCollection] Other interfaces collection + # @return [InterfacesCollection] New interfaces collection + def -(other) + self.class.new(to_a - other.to_a) + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.10/src/lib/y2network/proposal_settings.rb new/yast2-network-4.4.12/src/lib/y2network/proposal_settings.rb --- old/yast2-network-4.4.10/src/lib/y2network/proposal_settings.rb 2021-05-13 11:44:11.000000000 +0200 +++ new/yast2-network-4.4.12/src/lib/y2network/proposal_settings.rb 2021-05-31 12:26:49.000000000 +0200 @@ -33,6 +33,11 @@ # @return [Boolean] network service to be used after the installation attr_accessor :selected_backend attr_accessor :virt_bridge_proposal + attr_accessor :ipv4_forward + attr_accessor :ipv6_forward + attr_accessor :defaults_applied + + DEFAULTS = [:ipv4_forward, :ipv6_forward].freeze # Constructor def initialize @@ -45,6 +50,27 @@ @selected_backend = autoinst_backend @virt_bridge_proposal = autoinst_disabled_proposal? ? false : true + @defaults_applied = false + end + + # Modifies the proposal according to the given settings + # + # @param settings [Hash] network default settings to be loaded + def modify_defaults(settings = network_section) + load_features(settings) + @defaults_applied = false + end + + # Modifies the current network configuration according to the proposal. It does not touch the + # network configuration if the proposal settings were already applied + def apply_defaults + return if defaults_applied + return @defaults_applied = true if DEFAULTS.all? { |o| public_send(o).nil? } + + Yast::Lan.read_config(report: false) unless yast_config + yast_config.routing.forward_ipv4 = ipv4_forward unless ipv4_forward.nil? + yast_config.routing.forward_ipv6 = ipv6_forward unless ipv6_forward.nil? + @defaults_applied = true end def current_backend @@ -164,6 +190,36 @@ private + # Convenience method to load some features from a installation control file section + # + # @param source [Hash] network section to be loaded + def load_features(source = network_section) + return unless source.is_a?(Hash) + + source.keys.each { |k| load_feature(k, k, source: source) } + end + + # Reads a feature from a given hash and assign it to the corresponding object attribute + # + # @param feature [String, Symbol] feature name to be read + # @param to [String, Symbol] attribute name where to store the feature value + # @param source [Hash] from where to read the feature + def load_feature(feature, to, source: network_section) + return unless respond_to?("#{to}=") + + value = source[feature.to_s] + public_send("#{to}=", value) + end + + # Convenience method to read the control file network section + def network_section + Yast::ProductFeatures.GetSection("network") + end + + def yast_config + Yast::Lan.yast_config + end + def autoinst_backend auto_config = Yast::Lan.autoinst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.10/src/lib/y2network/wicked/config_writer.rb new/yast2-network-4.4.12/src/lib/y2network/wicked/config_writer.rb --- old/yast2-network-4.4.10/src/lib/y2network/wicked/config_writer.rb 2021-05-13 11:44:11.000000000 +0200 +++ new/yast2-network-4.4.12/src/lib/y2network/wicked/config_writer.rb 2021-05-31 12:26:49.000000000 +0200 @@ -73,7 +73,7 @@ end # Actions needed for removed interfaces - removed_ifaces = old_config ? old_config.interfaces.to_a - config.interfaces.to_a : [] + removed_ifaces = old_config ? old_config.interfaces - config.interfaces : [] removed_ifaces.each do |iface| file = routes_file_for(iface) file.remove diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.10/test/save_network_test.rb new/yast2-network-4.4.12/test/save_network_test.rb --- old/yast2-network-4.4.10/test/save_network_test.rb 2021-05-13 11:44:11.000000000 +0200 +++ new/yast2-network-4.4.12/test/save_network_test.rb 2021-05-31 12:26:49.000000000 +0200 @@ -60,6 +60,7 @@ .and_return(propose_bridge) allow(Yast::NetworkAutoconfiguration.instance).to receive(:configure_dns) allow(Yast::NetworkAutoconfiguration.instance).to receive(:configure_hosts) + allow(Yast::NetworkAutoconfiguration.instance).to receive(:configure_routing) allow(Yast::Lan).to receive(:yast_config).and_return(yast_config) allow(Yast::Lan).to receive(:system_config).and_return(system_config) allow(Yast::Lan).to receive(:write_config) @@ -170,12 +171,21 @@ context "if the hosts are not configured by AutoYaST" do it "configures the /etc/hosts automatically" do allow(Yast::NetworkAutoYast.instance).to receive(:configure_hosts).and_return(false) - expect(Yast::NetworkAutoconfiguration.instance).to_not receive(:configure_dns) + expect(Yast::NetworkAutoconfiguration.instance).to receive(:configure_hosts) subject.main end end end + context "in case of not written previously" do + it "configures dns, hosts and routing according to the proposal" do + expect(Yast::NetworkAutoconfiguration.instance).to receive(:configure_dns) + expect(Yast::NetworkAutoconfiguration.instance).to receive(:configure_routing) + expect(Yast::NetworkAutoconfiguration.instance).to receive(:configure_hosts) + subject.main + end + end + context "when the backend is network manager" do let(:selected_backend) { :network_manager } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.10/test/y2network/interfaces_collection_test.rb new/yast2-network-4.4.12/test/y2network/interfaces_collection_test.rb --- old/yast2-network-4.4.10/test/y2network/interfaces_collection_test.rb 2021-05-13 11:44:11.000000000 +0200 +++ new/yast2-network-4.4.12/test/y2network/interfaces_collection_test.rb 2021-05-31 12:26:49.000000000 +0200 @@ -158,4 +158,24 @@ expect(new_collection.to_a).to eq([eth0, br0]) end end + + describe "#-" do + let(:fake_interfaces) { 24.times.map { |i| Y2Network::PhysicalInterface.new("iface#{i}") } } + let(:interfaces) do + fake_interfaces + [br0, wlan0] + end + + let(:other) { Y2Network::InterfacesCollection.new(fake_interfaces[0..18] + [br0]) } + let(:other2) { Y2Network::InterfacesCollection.new(fake_interfaces) } + + it "returns a new collection with the interfaces which are only present in the object" do + new_collection = collection - other + # Using hash comparison + expect(new_collection.to_a).to eq(fake_interfaces[19..23] + [wlan0]) + + # Usin eql? comparison + new_collection -= other2 + expect(new_collection.to_a).to eq([wlan0]) + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.10/test/y2network/proposal_settings_test.rb new/yast2-network-4.4.12/test/y2network/proposal_settings_test.rb --- old/yast2-network-4.4.10/test/y2network/proposal_settings_test.rb 2021-05-13 11:44:11.000000000 +0200 +++ new/yast2-network-4.4.12/test/y2network/proposal_settings_test.rb 2021-05-31 12:26:49.000000000 +0200 @@ -425,4 +425,70 @@ end end end + + describe "#modify_defaults" do + let(:settings) { described_class.create_instance } + let(:feature) { { "network" => { "ipv4_forward" => true } } } + + context "in case of defined IP forwarding features in the control file" do + context "and no specific section is given" do + it "uses the profile network section" do + expect(settings).to receive(:load_features).with(feature["network"]) + settings.modify_defaults + end + end + + it "sets the IPv4 forwarding settings according to the feature value" do + settings.modify_defaults + expect(settings.ipv4_forward).to eql(true) + expect(settings.ipv6_forward).to eql(nil) + end + + it "sets the IPv6 forwarding settings according to the feature value" do + role_feature = { "network" => { "ipv6_forward" => true } } + settings.modify_defaults(role_feature["network"]) + expect(settings.ipv6_forward).to eql(true) + end + + it "sets the modified defaults as not applied" do + settings.defaults_applied = true + settings.modify_defaults + expect(settings.defaults_applied).to eql(false) + end + end + end + + describe "#apply_defaults" do + let(:settings) { described_class.create_instance } + let(:config) { Y2Network::Config.new(source: "test", routing: routing) } + let(:routing) { Y2Network::Routing.new(forward_ipv4: false, forward_ipv6: false, tables: []) } + let(:feature) { { "network" => { "ipv4_forward" => true } } } + + before do + allow(Yast::Lan).to receive(:yast_config).and_return(config) + settings.modify_defaults + end + + context "when the network defaults were already applied" do + it "does not touch any network configuration" do + settings.defaults_applied = true + expect(Yast::Lan).to_not receive(:yast_config) + settings.apply_defaults + end + end + + context "when the network defaults has not been applied yet" do + it "modifies the current network config with the modified defaults" do + expect(routing.forward_ipv4).to eql(false) + settings.apply_defaults + expect(routing.forward_ipv4).to eql(true) + end + + it "sets the modified defaults as already applied" do + expect(settings.defaults_applied).to eql(false) + settings.apply_defaults + expect(settings.defaults_applied).to eql(true) + end + end + end end