Hello community, here is the log from the commit of package yast2-network for openSUSE:Factory checked in at 2017-06-07 13:08:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-network (Old) and /work/SRC/openSUSE:Factory/.yast2-network.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-network" Wed Jun 7 13:08:21 2017 rev:372 rq:499657 version:3.2.28 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes 2017-04-12 17:10:40.734293297 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-network.new/yast2-network.changes 2017-06-07 13:08:22.259983939 +0200 @@ -1,0 +2,32 @@ +Thu May 25 09:27:09 UTC 2017 - mfi...@suse.com + +- bnc#1039532 + - do not write hostname into /etc/hosts duplicitly for one IP + - configure static IPs without own hostname to resolve to system + wide hostname during installation +- 3.2.28 + +------------------------------------------------------------------- +Mon May 22 13:19:22 UTC 2017 - gso...@suse.com + +- bsc#1036440 and bsc#994471 + - Command "yast remote list" should not alter the system. +- 3.2.27 + +------------------------------------------------------------------- +Wed May 17 09:41:29 UTC 2017 - mfi...@suse.com + +- bnc#1038521 + - do not raise an internal error during installation when + multiple static device and hostname configurations were + provided +- 3.2.26 + +------------------------------------------------------------------- +Tue May 16 07:45:01 UTC 2017 - knut.anders...@suse.com + +- bsc#1035908 + - Moved inst_install_inf client to yast2-installation. +- 3.2.25 + +------------------------------------------------------------------- Old: ---- yast2-network-3.2.24.tar.bz2 New: ---- yast2-network-3.2.28.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.Skn481/_old 2017-06-07 13:08:22.787909441 +0200 +++ /var/tmp/diff_new_pack.Skn481/_new 2017-06-07 13:08:22.791908878 +0200 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 3.2.24 +Version: 3.2.28 Release: 0 BuildArch: noarch ++++++ yast2-network-3.2.24.tar.bz2 -> yast2-network-3.2.28.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.24/package/yast2-network.changes new/yast2-network-3.2.28/package/yast2-network.changes --- old/yast2-network-3.2.24/package/yast2-network.changes 2017-04-11 16:51:32.229154641 +0200 +++ new/yast2-network-3.2.28/package/yast2-network.changes 2017-05-30 12:36:04.195065155 +0200 @@ -1,4 +1,36 @@ ------------------------------------------------------------------- +Thu May 25 09:27:09 UTC 2017 - mfi...@suse.com + +- bnc#1039532 + - do not write hostname into /etc/hosts duplicitly for one IP + - configure static IPs without own hostname to resolve to system + wide hostname during installation +- 3.2.28 + +------------------------------------------------------------------- +Mon May 22 13:19:22 UTC 2017 - gso...@suse.com + +- bsc#1036440 and bsc#994471 + - Command "yast remote list" should not alter the system. +- 3.2.27 + +------------------------------------------------------------------- +Wed May 17 09:41:29 UTC 2017 - mfi...@suse.com + +- bnc#1038521 + - do not raise an internal error during installation when + multiple static device and hostname configurations were + provided +- 3.2.26 + +------------------------------------------------------------------- +Tue May 16 07:45:01 UTC 2017 - knut.anders...@suse.com + +- bsc#1035908 + - Moved inst_install_inf client to yast2-installation. +- 3.2.25 + +------------------------------------------------------------------- Tue Apr 4 11:48:24 WEST 2017 - knut.anders...@suse.com - bsc#956755 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.24/package/yast2-network.spec new/yast2-network-3.2.28/package/yast2-network.spec --- old/yast2-network-3.2.24/package/yast2-network.spec 2017-04-11 16:51:32.229154641 +0200 +++ new/yast2-network-3.2.28/package/yast2-network.spec 2017-05-30 12:36:04.195065155 +0200 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 3.2.24 +Version: 3.2.28 Release: 0 BuildArch: noarch diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.24/src/clients/inst_install_inf.rb new/yast2-network-3.2.28/src/clients/inst_install_inf.rb --- old/yast2-network-3.2.24/src/clients/inst_install_inf.rb 2017-04-11 16:51:32.229154641 +0200 +++ new/yast2-network-3.2.28/src/clients/inst_install_inf.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,14 +0,0 @@ -require "yast" -require "network/install_inf_convertor" - -module Yast - class InstInstallInfClient < Client - def main - InstallInfConvertor.instance.write_netconfig - - :next - end - end -end - -Yast::InstInstallInfClient.new.main diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.24/src/clients/remote.rb new/yast2-network-3.2.28/src/clients/remote.rb --- old/yast2-network-3.2.24/src/clients/remote.rb 2017-04-11 16:51:32.229154641 +0200 +++ new/yast2-network-3.2.28/src/clients/remote.rb 2017-05-30 12:36:04.227065155 +0200 @@ -57,7 +57,6 @@ "id" => "remote", "guihandler" => fun_ref(method(:RemoteGUI), "any ()"), "initialize" => fun_ref(Remote.method(:Read), "boolean ()"), - "finish" => fun_ref(Remote.method(:Write), "boolean ()"), "actions" => { "list" => { # Commandline command help @@ -160,7 +159,7 @@ Remote.Disable end - true + Remote.Write end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.24/src/lib/network/install_inf_convertor.rb new/yast2-network-3.2.28/src/lib/network/install_inf_convertor.rb --- old/yast2-network-3.2.24/src/lib/network/install_inf_convertor.rb 2017-04-11 16:51:32.241154641 +0200 +++ new/yast2-network-3.2.28/src/lib/network/install_inf_convertor.rb 2017-05-30 12:36:04.315065155 +0200 @@ -21,18 +21,9 @@ end def initialize - Yast.import "Hostname" Yast.import "DNS" Yast.import "IP" - Yast.import "NetworkInterfaces" - Yast.import "FileUtils" - Yast.import "Netmask" Yast.import "Proxy" - Yast.import "String" - Yast.import "Arch" - - Yast.include self, "network/routines.rb" - Yast.include self, "network/complex.rb" end def write_netconfig diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.24/src/modules/Host.rb new/yast2-network-3.2.28/src/modules/Host.rb --- old/yast2-network-3.2.24/src/modules/Host.rb 2017-04-11 16:51:32.241154641 +0200 +++ new/yast2-network-3.2.28/src/modules/Host.rb 2017-05-30 12:36:04.319065155 +0200 @@ -222,12 +222,11 @@ # @param String ip to assign # @return true if success def Update(oldhn, newhn, ip) - Builtins.y2milestone( - "Updating /etc/hosts: %1 -> %2: %3", - oldhn, - newhn, - ip - ) + raise ArgumentError, "IP cannot be nil" if ip.nil? + raise ArgumentError, "Nonempty IP expected" if ip.empty? + + log.info("Updating /etc/hosts: #{oldhn} -> #{newhn}: #{ip}") + @modified = true # Remove old hostname from hosts @@ -244,7 +243,7 @@ return true if [nil, ""].include?(newhn) nick = Hostname.SplitFQ(newhn)[0] || "" - nick = nick.empty? ? [] : [nick] + nick = nick.empty? || nick == newhn ? [] : [nick] hosts = @hosts.host(ip) if hosts.empty? @hosts.add_entry(ip, newhn, nick) @@ -277,25 +276,39 @@ summary end + # Creates a list os static ips present in the system + # + # @return [Array<string>] list of ip addresses def StaticIPs NetworkInterfaces.Read devs = NetworkInterfaces.Locate("BOOTPROTO", "static") - devs = Builtins.filter(devs) { |dev| dev != "lo" } - ips = Builtins.maplist(devs) do |dev| - NetworkInterfaces.GetValue(dev, "IPADDR") - end - Builtins.y2milestone("ifcfgs: %1 IPs: %2", devs, ips) - deep_copy(ips) + + devs.reject! { |dev| dev == "lo" } + static_ips = devs.map { |dev| NetworkInterfaces.GetValue(dev, "IPADDR") } + static_ips.reject! { |ip| ip.nil? || ip.empty? } + + log.info("StaticIPs: found in ifcfgs: #{devs} IPs list: #{static_ips}") + + static_ips end - # if we have a static address, - # make sure /etc/hosts resolves it to our, bnc#664929 + # Configure system to resolve static ips without hostname to system wide hostname + # + # It is expected to be used during installation only. If user configures static + # ips during installation and do not assign them particular hostname, then such + # ips are configuret to resolve to the system wide hostname (see Hostname module, + # /etc/HOSTNAME) + # + # Originally implemented as a fix for bnc#664929, later extended for bnc#1039532 def ResolveHostnameToStaticIPs - static_ips = StaticIPs() - if Ops.greater_than(Builtins.size(static_ips), 0) - fqhostname = Hostname.MergeFQ(DNS.hostname, DNS.domain) - Update(fqhostname, fqhostname, static_ips) - end + # reject those static ips which have particular hostnames already configured + static_ips = StaticIPs().reject { |sip| @hosts.include_ip?(sip) } + return if static_ips.empty? + + fqhostname = Hostname.MergeFQ(DNS.hostname, DNS.domain) + + # assign system wide hostname to a static ip without particular hostname + static_ips.each { |sip| Update(fqhostname, fqhostname, sip) } nil end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.24/src/modules/Remote.rb new/yast2-network-3.2.28/src/modules/Remote.rb --- old/yast2-network-3.2.24/src/modules/Remote.rb 2017-04-11 16:51:32.245154641 +0200 +++ new/yast2-network-3.2.28/src/modules/Remote.rb 2017-05-30 12:36:04.323065155 +0200 @@ -147,20 +147,6 @@ Disable() end - # Package containing SuSEfirewall2 services has to be installed before - # reading SuSEFirewall, otherwise exception is thrown by firewall - if Package.Install(PKG_CONTAINING_FW_SERVICES) - current_progress = Progress.set(false) - SuSEFirewall.Read - Progress.set(current_progress) - else - Report.Error( - _("Package %{package} is not installed\nfirewall settings will be disabled.") % { - package: PKG_CONTAINING_FW_SERVICES - } - ) - end - true end @@ -196,6 +182,20 @@ # Update the SCR according to network settings # @return true on success def Write + # Package containing SuSEfirewall2 services has to be installed before + # reading SuSEFirewall, otherwise exception is thrown by firewall + if Package.Install(PKG_CONTAINING_FW_SERVICES) + current_progress = Progress.set(false) + SuSEFirewall.Read + Progress.set(current_progress) + else + Report.Error( + _("Package %{package} is not installed\nfirewall settings will be disabled.") % { + package: PKG_CONTAINING_FW_SERVICES + } + ) + end + steps = [ # Progress stage 1 _("Write firewall settings"), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.24/test/host_test.rb new/yast2-network-3.2.28/test/host_test.rb --- old/yast2-network-3.2.24/test/host_test.rb 2017-04-11 16:51:32.249154641 +0200 +++ new/yast2-network-3.2.28/test/host_test.rb 2017-05-30 12:36:04.335065155 +0200 @@ -189,6 +189,24 @@ expect(content.lines).to include("10.100.128.72 pepa pepa2 newname.suse.cz newname\n") end + + it "raises an error when empty ip is provided" do + expect { Yast::Host.Update("oldhostname", "newhostname", "") } + .to raise_error(ArgumentError, instance_of(String)) + end + + it "raises an error when nil ip is provided" do + expect { Yast::Host.Update("oldhostname", "newhostname", nil) } + .to raise_error(ArgumentError, instance_of(String)) + end + + it "doesn't write entry with duplicate hostname" do + ip = "1.1.1.1" + hostname = "linux" + + Yast::Host.Update(hostname, hostname, ip) + expect(Yast::Host.name_map[ip]).not_to eql ["#{hostname} #{hostname}"] + end end describe ".EnsureHostnameResolvable" do @@ -227,4 +245,92 @@ end end + + describe ".ResolveHostnameToStaticIPs" do + let(:static_ips) { ["1.1.1.1", "2.2.2.2"] } + let(:fqhostname) { "sles.suse.de" } + + before(:each) do + allow(Yast::Host) + .to receive(:StaticIPs) + .and_return(static_ips) + allow(Yast::Hostname).to receive(:MergeFQ).and_return(fqhostname) + end + + it "do not send array of IPs into .Update" do # bnc1038521 + expect(Yast::Host) + .not_to receive(:Update) + .with(instance_of(String), instance_of(String), instance_of(Array)) + + Yast::Host.ResolveHostnameToStaticIPs + end + + it "doesn't call .Update when an IP already has a hostname" do + hostname = "linux" + + Yast::Host.Update(hostname, hostname, static_ips[0]) + + expect(Yast::Host) + .not_to receive(:Update) + .with(fqhostname, fqhostname, static_ips[0]) + + Yast::Host.ResolveHostnameToStaticIPs + end + + it "doesn't call .Update when an IP already has a hostname" do + hostname = "linux" + + Yast::Host.Update(hostname, hostname, static_ips[0]) + + expect(Yast::Host.ResolveHostnameToStaticIPs) + .not_to receive(:Update) + .with(fqhostname, fqhostname, static_ips[0]) + end + end + + describe ".StaticIPs" do + before(:each) do + devs = { + "lo" => { + "BOOTPROTO" => "static", + "IPADDR" => "127.0.0.1" + }, + "eth0" => { "BOOTPROTO" => "static" }, + "eth1" => { "BOOTPROTO" => "dhcp" }, + "eth2" => { + "BOOTPROTO" => "static", + "IPADDR" => "1.1.1.1" + }, + "eth3" => { + "BOOTPROTO" => "static", + "IPADDR" => "" + } + } + + # do not touch system + allow(Yast::NetworkInterfaces) + .to receive(:Read) + + devs.each do |dev, conf| + allow(Yast::NetworkInterfaces) + .to receive(:Locate) + .and_return(devs.keys) + allow(Yast::NetworkInterfaces) + .to receive(:GetValue) + .with(dev, "IPADDR") + .and_return(conf["IPADDR"]) + end + end + + it "do not return invalid items for devices with static configuration but invalid IP" do + expect(Yast::Host.StaticIPs).not_to include "" + expect(Yast::Host.StaticIPs).not_to include nil + expect(Yast::Host.StaticIPs).not_to include "127.0.0.1" + end + + it "returns all devices with valid setup" do + expect(Yast::Host.StaticIPs).to include "1.1.1.1" + end + end + end