Hello community, here is the log from the commit of package yast2-network for openSUSE:Factory checked in at 2020-01-24 14:10:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-network (Old) and /work/SRC/openSUSE:Factory/.yast2-network.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-network" Fri Jan 24 14:10:31 2020 rev:418 rq:766616 version:4.2.47 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes 2020-01-17 16:03:50.484396171 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-network.new.26092/yast2-network.changes 2020-01-24 14:10:41.662399943 +0100 @@ -1,0 +2,21 @@ +Thu Jan 23 09:16:03 UTC 2020 - Imobach Gonzalez Sosa <igonzalezs...@suse.com> + +- Do not try to read an ifcfg-* file that does not exist + (bsc#1161234). + +------------------------------------------------------------------- +Wed Jan 22 16:43:21 UTC 2020 - Ancor Gonzalez Sosa <an...@suse.com> + +- Do not crash if install.inf contains an IP address that cannot + be resolved to a name (bsc#1161217) +- 4.2.47 + +------------------------------------------------------------------- +Tue Jan 21 07:24:03 UTC 2020 - Knut Anderssen <kanders...@suse.com> + +- bsc#1156986 + - Fix crash when logging that an interface is not connected or + is not bridgeable when proposing the virtualization config. +- 4.2.46 + +------------------------------------------------------------------- Old: ---- yast2-network-4.2.45.tar.bz2 New: ---- yast2-network-4.2.47.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.64I8O7/_old 2020-01-24 14:10:42.382400187 +0100 +++ /var/tmp/diff_new_pack.64I8O7/_new 2020-01-24 14:10:42.382400187 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.2.45 +Version: 4.2.47 Release: 0 Summary: YaST2 - Network Configuration License: GPL-2.0-only ++++++ yast2-network-4.2.45.tar.bz2 -> yast2-network-4.2.47.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.45/package/yast2-network.changes new/yast2-network-4.2.47/package/yast2-network.changes --- old/yast2-network-4.2.45/package/yast2-network.changes 2020-01-17 10:56:01.000000000 +0100 +++ new/yast2-network-4.2.47/package/yast2-network.changes 2020-01-23 10:30:31.000000000 +0100 @@ -1,4 +1,25 @@ ------------------------------------------------------------------- +Thu Jan 23 09:16:03 UTC 2020 - Imobach Gonzalez Sosa <igonzalezs...@suse.com> + +- Do not try to read an ifcfg-* file that does not exist + (bsc#1161234). + +------------------------------------------------------------------- +Wed Jan 22 16:43:21 UTC 2020 - Ancor Gonzalez Sosa <an...@suse.com> + +- Do not crash if install.inf contains an IP address that cannot + be resolved to a name (bsc#1161217) +- 4.2.47 + +------------------------------------------------------------------- +Tue Jan 21 07:24:03 UTC 2020 - Knut Anderssen <kanders...@suse.com> + +- bsc#1156986 + - Fix crash when logging that an interface is not connected or + is not bridgeable when proposing the virtualization config. +- 4.2.46 + +------------------------------------------------------------------- Wed Jan 15 09:55:05 UTC 2020 - Knut Anderssen <kanders...@suse.com> - bsc#1158025 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.45/package/yast2-network.spec new/yast2-network-4.2.47/package/yast2-network.spec --- old/yast2-network-4.2.45/package/yast2-network.spec 2020-01-17 10:56:01.000000000 +0100 +++ new/yast2-network-4.2.47/package/yast2-network.spec 2020-01-23 10:30:31.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.2.45 +Version: 4.2.47 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.2.45/src/lib/y2network/sysconfig/hostname_reader.rb new/yast2-network-4.2.47/src/lib/y2network/sysconfig/hostname_reader.rb --- old/yast2-network-4.2.45/src/lib/y2network/sysconfig/hostname_reader.rb 2020-01-17 10:56:01.000000000 +0100 +++ new/yast2-network-4.2.47/src/lib/y2network/sysconfig/hostname_reader.rb 2020-01-23 10:30:31.000000000 +0100 @@ -92,7 +92,9 @@ end host, _domain = *Yast::Hostname.SplitFQ(fqdn) - host.empty? ? nil : host + return nil if host.nil? || host.empty? + + host end # Reads the (transient) hostname known to the resolver diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.45/src/lib/y2network/sysconfig/interface_file.rb new/yast2-network-4.2.47/src/lib/y2network/sysconfig/interface_file.rb --- old/yast2-network-4.2.45/src/lib/y2network/sysconfig/interface_file.rb 2020-01-17 10:56:01.000000000 +0100 +++ new/yast2-network-4.2.47/src/lib/y2network/sysconfig/interface_file.rb 2020-01-23 10:30:31.000000000 +0100 @@ -74,11 +74,8 @@ # @param interface [String] Interface name # @return [Sysconfig::InterfaceFile,nil] Sysconfig def find(interface) - if !Yast::FileUtils.Exists(SYSCONFIG_NETWORK_DIR.join("ifcfg-#{interface}").to_s) - return nil - end - - new(interface) + file = new(interface) + file.exist? ? file : nil end # Defines a parameter @@ -430,11 +427,18 @@ # Removes the file def remove - return unless Yast::FileUtils.Exists(path.to_s) + return unless exist? Yast::SCR.Execute(Yast::Path.new(".target.remove"), path.to_s) end + # Determines whether the ifcfg-* file exists + # + # @return [Boolean] true if the file exists; false otherwise + def exist? + Yast::FileUtils.Exists(path.to_s) + end + private # Detects interface type according to type specific option and its value @@ -497,8 +501,12 @@ # # @return [Array<String>] name of keys that are included in the file def defined_variables - @defined_variables ||= Yast::SCR.Dir(Yast::Path.new(".network.value.\"#{interface}\"")) || - [] + return @defined_variables if @defined_variables + + if exist? + @defined_variables = Yast::SCR.Dir(Yast::Path.new(".network.value.\"#{interface}\"")) + end + @defined_variables ||= [] end # Fetches the value for a given key diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.45/src/lib/y2network/virtualization_config.rb new/yast2-network-4.2.47/src/lib/y2network/virtualization_config.rb --- old/yast2-network-4.2.45/src/lib/y2network/virtualization_config.rb 2020-01-17 10:56:01.000000000 +0100 +++ new/yast2-network-4.2.47/src/lib/y2network/virtualization_config.rb 2020-01-23 10:30:31.000000000 +0100 @@ -26,6 +26,7 @@ # This class is responsible for creating a bridge configuration for # virtualization from the interfaces that are connected and bridgeable. class VirtualizationConfig + include Yast::Logger # @return [Y2Network::Config] attr_reader :config diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.45/test/y2network/hostname_reader_test.rb new/yast2-network-4.2.47/test/y2network/hostname_reader_test.rb --- old/yast2-network-4.2.45/test/y2network/hostname_reader_test.rb 2020-01-17 10:56:01.000000000 +0100 +++ new/yast2-network-4.2.47/test/y2network/hostname_reader_test.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,156 +0,0 @@ -# Copyright (c) [2019] 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/sysconfig/hostname_reader" - -describe Y2Network::Sysconfig::HostnameReader do - subject(:reader) { described_class.new } - - describe "#hostname" do - let(:install_inf_hostname) { "linuxrc" } - let(:dhcp_hostname) { "dhcp" } - let(:system_hostname) { "system" } - let(:resolver_hostname) { "system.suse.de" } - - before do - allow(reader).to receive(:hostname_from_install_inf).and_return(install_inf_hostname) - allow(reader).to receive(:hostname_from_dhcp).and_return(dhcp_hostname) - allow(reader).to receive(:hostname_from_system).and_return(system_hostname) - allow(reader).to receive(:hostname_from_resolver).and_return(resolver_hostname) - end - - context "during installation" do - let(:install_inf_exists?) { true } - - before do - allow(Yast::Stage).to receive(:initial).and_return(true) - end - - it "reads the hostname from /etc/install.conf" do - expect(reader.hostname_from_install_inf).to eq("linuxrc") - end - - context "when the /etc/install.inf file does not exists" do - let(:install_inf_hostname) { nil } - - it "returns nil" do - expect(reader.hostname_from_install_inf).to be_nil - end - end - end - end - - describe "#hostname_from_install_inf" do - let(:hostname) { "foo.bar.com" } - - before do - allow(Yast::SCR).to receive(:Read).and_return(hostname) - end - - it "returns the hostname (without the domain)" do - expect(reader.hostname_from_install_inf).to eq("foo") - end - - context "when the Hostname is not defined in the install.inf file" do - let(:hostname) { nil } - - it "returns nil" do - expect(reader.hostname_from_install_inf).to be_nil - end - end - - context "when an IP address is used instead of a hostname" do - let(:hostname) { "foo1.bar.cz" } - - before do - allow(Yast::NetHwDetection).to receive(:ResolveIP).and_return(hostname) - end - - it "returns the associated hostname" do - expect(reader.hostname_from_install_inf).to eq("foo1") - end - - context "and it is not resolvable to an IP" do - let(:hostname) { nil } - - it "returns nil" do - expect(reader.hostname_from_install_inf).to be_nil - end - end - end - end - - describe "#hostname_from_system" do - it "returns the systems' hostname" do - expect(Yast::Execute).to receive(:on_target!) - .with("/usr/bin/hostname", stdout: :capture) - .and_return("foo\n") - expect(reader.hostname_from_system).to eq("foo") - end - - context "when the hostname cannot be determined" do - let(:hostname_content) { "bar\n" } - - before do - allow(Yast::Execute).to receive(:on_target!) - .with("/usr/bin/hostname", stdout: :capture) - .and_raise(Cheetah::ExecutionFailed.new([], "", nil, nil)) - allow(Yast::SCR).to receive(:Read).with(Yast::Path.new(".target.string"), "/etc/hostname") - .and_return(hostname_content) - end - - it "returns the name in /etc/hostname" do - expect(reader.hostname_from_system).to eq("bar") - end - - context "when the /etc/hostname file is empty" do - let(:hostname_content) { "\n" } - - it "returns nil" do - expect(reader.hostname_from_system).to be_nil - end - end - end - end - - describe "hostname_from_dhcp" do - before(:each) do - allow(Yast::NetworkService).to receive(:is_wicked).and_return(true) - - allow(File).to receive(:file?).and_return(false) - end - - around { |e| change_scr_root(File.join(DATA_PATH, "scr_read"), &e) } - - it "returns name provided as part of dhcp configuration when available on any interface" do - allow(File) - .to receive(:file?) - .with("/var/lib/wicked/lease-eth4-dhcp-ipv4.xml") - .and_return(true) - allow(Yast::SCR).to receive(:Execute).and_return("stdout" => "tumbleweed\n") - - expect(reader.hostname_from_dhcp).to eql "tumbleweed" - end - - it "returns nil when no hostname was obtained from dhcp" do - expect(reader.hostname_from_dhcp).to be_nil - end - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.45/test/y2network/sysconfig/hostname_reader_test.rb new/yast2-network-4.2.47/test/y2network/sysconfig/hostname_reader_test.rb --- old/yast2-network-4.2.45/test/y2network/sysconfig/hostname_reader_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-network-4.2.47/test/y2network/sysconfig/hostname_reader_test.rb 2020-01-23 10:30:31.000000000 +0100 @@ -0,0 +1,169 @@ +# Copyright (c) [2019] 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/sysconfig/hostname_reader" + +describe Y2Network::Sysconfig::HostnameReader do + subject(:reader) { described_class.new } + + describe "#config" do + let(:install_inf_hostname) { "linuxrc" } + let(:dhcp_hostname) { "dhcp" } + let(:system_hostname) { "system" } + let(:resolver_hostname) { "system.suse.de" } + + before do + allow(reader).to receive(:hostname_from_install_inf).and_return(install_inf_hostname) + allow(reader).to receive(:hostname_from_dhcp).and_return(dhcp_hostname) + allow(reader).to receive(:hostname_from_system).and_return(system_hostname) + allow(reader).to receive(:hostname_from_resolver).and_return(resolver_hostname) + + allow(Yast::Stage).to receive(:initial).and_return(installation) + end + + RSpec.shared_examples "installer and static" do + it "reads the installer hostname from /etc/install.conf" do + expect(reader.config.installer).to eq("linuxrc") + end + + it "reads the static hostname from the system" do + expect(reader.config.static).to eq("system") + end + end + + context "during installation" do + let(:installation) { true } + + include_examples "installer and static" + + it "reads the transient hostname from DHCP" do + expect(reader.config.transient).to eq("dhcp") + end + end + + context "in an installed system" do + let(:installation) { false } + + include_examples "installer and static" + + it "reads the transient hostname from the resolver" do + expect(reader.config.transient).to eq("system.suse.de") + end + end + end + + describe "#hostname_from_install_inf" do + let(:hostname) { "foo.bar.com" } + + before do + allow(Yast::SCR).to receive(:Read).and_return(hostname) + end + + it "returns the hostname (without the domain)" do + expect(reader.hostname_from_install_inf).to eq("foo") + end + + context "when the Hostname is not defined in the install.inf file" do + let(:hostname) { nil } + + it "returns nil" do + expect(reader.hostname_from_install_inf).to be_nil + end + end + + context "when an IP address is used instead of a hostname" do + let(:hostname) { "192.168.1.1" } + let(:resolved_hostname) { "foo1.bar.cz" } + + before do + allow(Yast::NetHwDetection).to receive(:ResolveIP).and_return(resolved_hostname) + end + + it "returns the associated hostname" do + expect(reader.hostname_from_install_inf).to eq("foo1") + end + + context "and it is not resolvable to an IP" do + let(:resolved_hostname) { nil } + + it "returns nil" do + expect(reader.hostname_from_install_inf).to be_nil + end + end + end + end + + describe "#hostname_from_system" do + it "returns the systems' hostname" do + expect(Yast::Execute).to receive(:on_target!) + .with("/usr/bin/hostname", stdout: :capture) + .and_return("foo\n") + expect(reader.hostname_from_system).to eq("foo") + end + + context "when the hostname cannot be determined" do + let(:hostname_content) { "bar\n" } + + before do + allow(Yast::Execute).to receive(:on_target!) + .with("/usr/bin/hostname", stdout: :capture) + .and_raise(Cheetah::ExecutionFailed.new([], "", nil, nil)) + allow(Yast::SCR).to receive(:Read).with(Yast::Path.new(".target.string"), "/etc/hostname") + .and_return(hostname_content) + end + + it "returns the name in /etc/hostname" do + expect(reader.hostname_from_system).to eq("bar") + end + + context "when the /etc/hostname file is empty" do + let(:hostname_content) { "\n" } + + it "returns nil" do + expect(reader.hostname_from_system).to be_nil + end + end + end + end + + describe "hostname_from_dhcp" do + before(:each) do + allow(Yast::NetworkService).to receive(:is_wicked).and_return(true) + + allow(File).to receive(:file?).and_return(false) + end + + around { |e| change_scr_root(File.join(DATA_PATH, "scr_read"), &e) } + + it "returns name provided as part of dhcp configuration when available on any interface" do + allow(File) + .to receive(:file?) + .with("/var/lib/wicked/lease-eth4-dhcp-ipv4.xml") + .and_return(true) + allow(Yast::SCR).to receive(:Execute).and_return("stdout" => "tumbleweed\n") + + expect(reader.hostname_from_dhcp).to eql "tumbleweed" + end + + it "returns nil when no hostname was obtained from dhcp" do + expect(reader.hostname_from_dhcp).to be_nil + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.45/test/y2network/sysconfig/interface_file_test.rb new/yast2-network-4.2.47/test/y2network/sysconfig/interface_file_test.rb --- old/yast2-network-4.2.45/test/y2network/sysconfig/interface_file_test.rb 2020-01-17 10:56:01.000000000 +0100 +++ new/yast2-network-4.2.47/test/y2network/sysconfig/interface_file_test.rb 2020-01-23 10:30:31.000000000 +0100 @@ -65,6 +65,26 @@ end end + describe "#exist?" do + subject(:file) { described_class.new(interface) } + + context "when the file for the given interface exists" do + let(:interface) { "eth0" } + + it "returns true" do + expect(file.exist?).to eq(true) + end + end + + context "when the file for the given interface does not exist" do + let(:interface) { "em1" } + + it "returns false" do + expect(file.exist?).to eq(false) + end + end + end + describe "#remove" do subject(:file) { described_class.find("eth0") }