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-09-26 21:48:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-network (Old) and /work/SRC/openSUSE:Factory/.yast2-network.new.1899 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-network" Sun Sep 26 21:48:22 2021 rev:462 rq:921307 version:4.4.25 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes 2021-09-11 22:24:29.063383881 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-network.new.1899/yast2-network.changes 2021-09-26 21:49:00.422800480 +0200 @@ -1,0 +2,13 @@ +Thu Sep 23 10:01:21 UTC 2021 - Imobach Gonzalez Sosa <igonzalezs...@suse.com> + +- Consider aliases sections as case insensitive (bsc#1190739). +- 4.4.25 + +------------------------------------------------------------------- +Wed Sep 22 08:46:16 UTC 2021 - Michal Filka <mfi...@suse.com> + +- bnc#1190645 + - display user defined device name in the devices overview +- 4.4.24 + +------------------------------------------------------------------- Old: ---- yast2-network-4.4.23.tar.bz2 New: ---- yast2-network-4.4.25.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.4O4Nym/_old 2021-09-26 21:49:00.982801104 +0200 +++ /var/tmp/diff_new_pack.4O4Nym/_new 2021-09-26 21:49:00.986801109 +0200 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.4.23 +Version: 4.4.25 Release: 0 Summary: YaST2 - Network Configuration License: GPL-2.0-only ++++++ yast2-network-4.4.23.tar.bz2 -> yast2-network-4.4.25.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.23/package/yast2-network.changes new/yast2-network-4.4.25/package/yast2-network.changes --- old/yast2-network-4.4.23/package/yast2-network.changes 2021-09-07 11:17:51.000000000 +0200 +++ new/yast2-network-4.4.25/package/yast2-network.changes 2021-09-24 14:00:23.000000000 +0200 @@ -1,4 +1,17 @@ ------------------------------------------------------------------- +Thu Sep 23 10:01:21 UTC 2021 - Imobach Gonzalez Sosa <igonzalezs...@suse.com> + +- Consider aliases sections as case insensitive (bsc#1190739). +- 4.4.25 + +------------------------------------------------------------------- +Wed Sep 22 08:46:16 UTC 2021 - Michal Filka <mfi...@suse.com> + +- bnc#1190645 + - display user defined device name in the devices overview +- 4.4.24 + +------------------------------------------------------------------- Tue Sep 7 07:41:52 UTC 2021 - Knut Anderssen <kanders...@suse.com> - Add support for reading the default NTP servers from the control diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.23/package/yast2-network.spec new/yast2-network-4.4.25/package/yast2-network.spec --- old/yast2-network-4.4.23/package/yast2-network.spec 2021-09-07 11:17:51.000000000 +0200 +++ new/yast2-network-4.4.25/package/yast2-network.spec 2021-09-24 14:00:23.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.4.23 +Version: 4.4.25 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.23/src/lib/y2network/autoinst/interfaces_reader.rb new/yast2-network-4.4.25/src/lib/y2network/autoinst/interfaces_reader.rb --- old/yast2-network-4.4.23/src/lib/y2network/autoinst/interfaces_reader.rb 2021-09-07 11:17:51.000000000 +0200 +++ new/yast2-network-4.4.25/src/lib/y2network/autoinst/interfaces_reader.rb 2021-09-24 14:00:23.000000000 +0200 @@ -128,10 +128,10 @@ config.ip = load_ipaddr(interface_section) # handle aliases - interface_section.aliases.values.each_with_index do |alias_h, index| - next if alias_h.fetch("IPADDR", "").empty? + interface_section.aliases.each_with_index do |section, index| + next if section.ipaddr.to_s.empty? - config.ip_aliases << load_alias(alias_h, id: "_#{index}") + config.ip_aliases << load_alias(section, id: "_#{index}") end # startmode @@ -207,16 +207,16 @@ # Loads and initializates an IP alias according to given hash with alias details # - # @param alias_h [Hash] hash of AY profile's alias section as obtained from parser + # @param section[AliasSection] hash of AY profile's alias section as obtained from parser # # @return [ConnectionConfig::IPConfig] alias details - def load_alias(alias_h, id: nil) - ipaddr = IPAddress.from_string(alias_h["IPADDR"]) + def load_alias(section, id: nil) + ipaddr = IPAddress.from_string(section.ipaddr) # Assign first netmask, as prefixlen has precedence so it will overwrite it - ipaddr.prefix = prefix_for(alias_h["NETMASK"]) if !alias_h.fetch("NETMASK", "").empty? - ipaddr.prefix = prefix_for(alias_h["PREFIXLEN"]) if !alias_h.fetch("PREFIXLEN", "").empty? + ipaddr.prefix = prefix_for(section.netmask) unless section.netmask.to_s.empty? + ipaddr.prefix = prefix_for(section.prefixlen) unless section.prefixlen.to_s.empty? - ConnectionConfig::IPConfig.new(ipaddr, id: id, label: alias_h["LABEL"]) + ConnectionConfig::IPConfig.new(ipaddr, id: id, label: section.label) end def load_wireless(config, interface_section) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.23/src/lib/y2network/autoinst_profile/alias_section.rb new/yast2-network-4.4.25/src/lib/y2network/autoinst_profile/alias_section.rb --- old/yast2-network-4.4.23/src/lib/y2network/autoinst_profile/alias_section.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-network-4.4.25/src/lib/y2network/autoinst_profile/alias_section.rb 2021-09-24 14:00:23.000000000 +0200 @@ -0,0 +1,91 @@ +# Copyright (c) [2021] SUSE LLC +# +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of version 2 of the GNU General Public License as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, contact SUSE LLC. +# +# To contact SUSE LLC about this file by physical or electronic mail, you may +# find current contact information at www.suse.com. + +require "installation/autoinst_profile/section_with_attributes" + +module Y2Network + module AutoinstProfile + # This class represents an alias specification within the <interface> section. + # + # <aliases> + # <alias0> + # <IPADDR>192.168.1.100</IPADDR> + # <LABEL>1</LABEL> + # <PREFIXLEN>24</PREFIXLEN> + # </alias0> + # </aliases> + # + # It is case insensitive. + # + # @see InterfaceSection + class AliasSection < ::Installation::AutoinstProfile::SectionWithAttributes + def self.attributes + [ + { name: :ipaddr }, + { name: :label }, + { name: :prefixlen }, + { name: :netmask } + ] + end + + define_attr_accessors + + # @!attribute ipaddr + # @return [String] IP address + + # @!attribute label + # @return [String] alias label + + # @!attribute prefixlen + # @return [String] prefix length + # + # @!attribute netmask + # @return [String] IP netmask + + # Clones an IP config into an AutoYaST alias section + # + # @param config [Y2Network::ConnectionConfig::IPConfig] IP address configuration + # @return [AliasSection] + def self.new_from_network(config) + result = new + result.init_from_config(config) + result + end + + # Method used by {.new_from_network} to populate the attributes when cloning an IP config + # + # @param config [Y2Network::ConnectionConfig] + # @return [Boolean] + def init_from_config(config) + @ipaddr = config.address&.address&.to_s + @label = config.label + @prefixlen = config.address&.prefix&.to_s + end + + # Method used by {.new_from_hashes} to populate the attributes using a hash + # + # @param config [Hash] + # @return [Boolean] + def init_from_hashes(config) + normalized_config = config.each_with_object({}) { |(k, v), c| c[k.downcase] = v } + super(normalized_config) + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.23/src/lib/y2network/autoinst_profile/interface_section.rb new/yast2-network-4.4.25/src/lib/y2network/autoinst_profile/interface_section.rb --- old/yast2-network-4.4.23/src/lib/y2network/autoinst_profile/interface_section.rb 2021-09-07 11:17:51.000000000 +0200 +++ new/yast2-network-4.4.25/src/lib/y2network/autoinst_profile/interface_section.rb 2021-09-24 14:00:23.000000000 +0200 @@ -18,6 +18,7 @@ # find current contact information at www.suse.com. require "installation/autoinst_profile/section_with_attributes" +require "y2network/autoinst_profile/alias_section" module Y2Network module AutoinstProfile @@ -167,23 +168,7 @@ # @return [String] bonding options # @!attribute aliases - # @example xml section for aliases from SLE15 - # <aliases> - # <alias0> - # <IPADDR>10.100.0.1</IPADDR> - # <LABEL>test</LABEL> - # <NETMASK>255.255.255.0</NETMASK> - # <PREFIXLEN>24</PREFIXLEN> - # </alias0> - # <alias1> - # <IPADDR>10.100.0.2</IPADDR> - # <LABEL>test2</LABEL> - # <NETMASK>255.255.255.0</NETMASK> - # <PREFIXLEN>24</PREFIXLEN> - # </alias1> - # </aliases> - # - # @return [Object] aliases for interface + # @return [Array<AliasSection>] list of IP aliases # @!attribute mtu # @return [String] MTU for interface @@ -273,7 +258,7 @@ public_send(:"#{attr[:name]}=", "") end - self.aliases = {} + self.aliases = [] end # Overwrite base method to load also nested aliases @@ -281,7 +266,9 @@ hash = rename_key(hash, "bridge_forwarddelay", "bridge_forward_delay") super(hash) - self.aliases = hash["aliases"].is_a?(Hash) ? hash["aliases"] : {} + return unless hash["aliases"].is_a?(Hash) + + self.aliases = hash["aliases"].values.map { |h| AliasSection.new_from_hashes(h) } end # Method used by {.new_from_network} to populate the attributes when cloning a network @@ -313,13 +300,7 @@ @ethtool_options = config.ethtool_options if config.ethtool_options @zone = config.firewall_zone.to_s # see aliases for example output - @aliases = config.ip_aliases.each_with_index.each_with_object({}) do |(ip, index), res| - res["alias#{index}"] = { - "IPADDR" => ip.address.address.to_s, - "LABEL" => ip.label || "", - "PREFIXLEN" => ip.address.prefix.to_s - } - end + @aliases = config.ip_aliases.map { |ip| AliasSection.new_from_network(ip) } case config when ConnectionConfig::Vlan @@ -345,7 +326,12 @@ # @see SectionWithAttributes#to_hashes def to_hashes hash = super - hash.delete("aliases") if hash.key?("aliases") && hash["aliases"].empty? + alias_sections = hash.delete("aliases") + if alias_sections && !alias_sections.empty? + hash["aliases"] = alias_sections.each_with_object({}).each_with_index do |(a, all), idx| + all["alias#{idx}"] = a + end + end hash end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.23/src/lib/y2network/interface.rb new/yast2-network-4.4.25/src/lib/y2network/interface.rb --- old/yast2-network-4.4.23/src/lib/y2network/interface.rb 2021-09-07 11:17:51.000000000 +0200 +++ new/yast2-network-4.4.25/src/lib/y2network/interface.rb 2021-09-24 14:00:23.000000000 +0200 @@ -40,8 +40,6 @@ # @return [String] Device name ('eth0', 'wlan0', etc.) attr_accessor :name - # @return [String] Interface description - attr_accessor :description # @return [InterfaceType] Interface type attr_accessor :type # @return [HwInfo] @@ -75,7 +73,6 @@ # @param type [InterfaceType] Interface type def initialize(name, type: InterfaceType::ETHERNET) @name = name.freeze - @description = "" @type = type # TODO: move renaming logic to physical interfaces only @renaming_mechanism = :none diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.23/src/lib/y2network/widgets/interfaces_table.rb new/yast2-network-4.4.25/src/lib/y2network/widgets/interfaces_table.rb --- old/yast2-network-4.4.23/src/lib/y2network/widgets/interfaces_table.rb 2021-09-07 11:17:51.000000000 +0200 +++ new/yast2-network-4.4.25/src/lib/y2network/widgets/interfaces_table.rb 2021-09-24 14:00:23.000000000 +0200 @@ -99,15 +99,19 @@ "" end + # Constructs device description for inactive s390 devices def device_item(device) [device.id, friendly_name(device), _("Not activated"), device.id, ""] end + # Generic device description handler def interface_item(interface) conn = config.connections.by_name(interface.name) [ - interface.name, # first is ID in table - friendly_name(interface), + # first is (item) ID in table + interface.name, + # if user named the connection explicitly, it will have precendence + conn.description || friendly_name(interface), interface_protocol(conn), interface.name, note(interface, conn) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.23/test/y2network/autoinst_profile/alias_section_test.rb new/yast2-network-4.4.25/test/y2network/autoinst_profile/alias_section_test.rb --- old/yast2-network-4.4.23/test/y2network/autoinst_profile/alias_section_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-network-4.4.25/test/y2network/autoinst_profile/alias_section_test.rb 2021-09-24 14:00:23.000000000 +0200 @@ -0,0 +1,67 @@ +# Copyright (c) [2021] SUSE LLC +# +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of version 2 of the GNU General Public License as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, contact SUSE LLC. +# +# To contact SUSE LLC about this file by physical or electronic mail, you may +# find current contact information at www.suse.com. + +require_relative "../../test_helper" +require "y2network/autoinst_profile/alias_section" +require "y2network/connection_config/ip_config" + +describe Y2Network::AutoinstProfile::AliasSection do + subject(:section) { described_class.new } + + describe ".new_from_network" do + let(:config) do + Y2Network::ConnectionConfig::IPConfig.new( + Y2Network::IPAddress.from_string("10.100.0.1/24"), label: "test" + ) + end + + it "initializes values properly" do + section = described_class.new_from_network(config) + expect(section.ipaddr).to eq("10.100.0.1") + expect(section.prefixlen).to eq("24") + expect(section.label).to eq("test") + end + end + + describe ".new_from_hashes" do + let(:hash) do + { "ipaddr" => "10.100.0.1", "prefixlen" => "24", "label" => "test" } + end + + it "returns a section with the corresponding values" do + section = described_class.new_from_hashes(hash) + expect(section.ipaddr).to eq("10.100.0.1") + expect(section.prefixlen).to eq("24") + expect(section.label).to eq("test") + end + + context "when keys use capital letters" do + let(:hash) do + { "IPADDR" => "10.100.0.1", "PREFIXLEN" => "24", "LABEL" => "test" } + end + + it "returns a section with the corresponding values" do + section = described_class.new_from_hashes(hash) + expect(section.ipaddr).to eq("10.100.0.1") + expect(section.prefixlen).to eq("24") + expect(section.label).to eq("test") + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.23/test/y2network/autoinst_profile/interface_section_test.rb new/yast2-network-4.4.25/test/y2network/autoinst_profile/interface_section_test.rb --- old/yast2-network-4.4.23/test/y2network/autoinst_profile/interface_section_test.rb 2021-09-07 11:17:51.000000000 +0200 +++ new/yast2-network-4.4.25/test/y2network/autoinst_profile/interface_section_test.rb 2021-09-24 14:00:23.000000000 +0200 @@ -41,9 +41,6 @@ c.ip_aliases = [ Y2Network::ConnectionConfig::IPConfig.new( Y2Network::IPAddress.from_string("10.100.0.1/24"), label: "test" - ), - Y2Network::ConnectionConfig::IPConfig.new( - Y2Network::IPAddress.from_string("10.100.0.2/24"), label: "test1" ) ] end @@ -56,11 +53,11 @@ expect(section.bootproto).to eq("static") expect(section.ipaddr).to eq("10.100.0.1") expect(section.prefixlen).to eq("24") - expect(section.lladdr).to eq("02:0b:0c:0d:0e:02") - expect(section.aliases).to eq( - "alias0" => { "IPADDR" => "10.100.0.1", "PREFIXLEN" => "24", "LABEL" => "test" }, - "alias1" => { "IPADDR" => "10.100.0.2", "PREFIXLEN" => "24", "LABEL" => "test1" } - ) + + alias0 = section.aliases.first + expect(alias0.ipaddr).to eq("10.100.0.1") + expect(alias0.prefixlen).to eq("24") + expect(alias0.label).to eq("test") end it "sets the parent section" do @@ -131,7 +128,7 @@ it "does not break and initializes the aliases as an empty hash" do section = described_class.new_from_hashes(hash) - expect(section.aliases).to eql({}) + expect(section.aliases).to eql([]) end end end @@ -140,12 +137,16 @@ subject(:section) do described_class.new_from_hashes( "device" => "eth0", - "aliases" => { "alias0" => { "IPADDR" => "10.100.0.1", "PREFIXLEN" => "24" } } + "aliases" => aliases_hash ) end + let(:aliases_hash) do + { "alias0" => { "ipaddr" => "10.100.0.1", "prefixlen" => "24" } } + end + it "exports the aliases key" do - expect(section.to_hashes["aliases"]).to eq(section.aliases) + expect(section.to_hashes["aliases"]).to eq(aliases_hash) end context "when the list of aliases is empty" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.4.23/test/y2network/widgets/interfaces_table_test.rb new/yast2-network-4.4.25/test/y2network/widgets/interfaces_table_test.rb --- old/yast2-network-4.4.23/test/y2network/widgets/interfaces_table_test.rb 2021-09-07 11:17:51.000000000 +0200 +++ new/yast2-network-4.4.25/test/y2network/widgets/interfaces_table_test.rb 2021-09-24 14:00:23.000000000 +0200 @@ -123,6 +123,19 @@ expect(description).to receive(:value=).with(/Device Name: eth0/) subject.handle end + + context "and when the device is named by user" do + let(:eth0_conn) do + Y2Network::ConnectionConfig::Ethernet.new.tap do |c| + c.name = "eth0" + c.description = "Custom description" + end + end + + it "uses custom device name" do + expect(subject.items).to include(a_collection_including(/Custom description/)) + end + end end context "when the device is not configured" do