Hello community, here is the log from the commit of package yast2-network for openSUSE:Factory checked in at 2018-11-27 10:39:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-network (Old) and /work/SRC/openSUSE:Factory/.yast2-network.new.19453 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-network" Tue Nov 27 10:39:07 2018 rev:395 rq:651993 version:4.1.18 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes 2018-11-18 23:00:42.207633536 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-network.new.19453/yast2-network.changes 2018-11-27 10:39:11.208392992 +0100 @@ -1,0 +2,14 @@ +Mon Nov 26 09:28:29 UTC 2018 - mfi...@suse.com + +- bnc#709176 + - keep original hostnames untouched in /etc/hosts when only IP + changed +- 4.1.18 + +------------------------------------------------------------------- +Thu Nov 22 11:54:59 UTC 2018 - mfi...@suse.com + +- bnc#1107470 + - this bug is fixed since 4.0.14 (3.2.47) + +------------------------------------------------------------------- Old: ---- yast2-network-4.1.17.tar.bz2 New: ---- yast2-network-4.1.18.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.LDTgaZ/_old 2018-11-27 10:39:11.952392243 +0100 +++ /var/tmp/diff_new_pack.LDTgaZ/_new 2018-11-27 10:39:11.952392243 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.1.17 +Version: 4.1.18 Release: 0 BuildArch: noarch ++++++ yast2-network-4.1.17.tar.bz2 -> yast2-network-4.1.18.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.1.17/package/yast2-network.changes new/yast2-network-4.1.18/package/yast2-network.changes --- old/yast2-network-4.1.17/package/yast2-network.changes 2018-11-15 09:53:16.000000000 +0100 +++ new/yast2-network-4.1.18/package/yast2-network.changes 2018-11-26 12:54:27.000000000 +0100 @@ -1,4 +1,18 @@ ------------------------------------------------------------------- +Mon Nov 26 09:28:29 UTC 2018 - mfi...@suse.com + +- bnc#709176 + - keep original hostnames untouched in /etc/hosts when only IP + changed +- 4.1.18 + +------------------------------------------------------------------- +Thu Nov 22 11:54:59 UTC 2018 - mfi...@suse.com + +- bnc#1107470 + - this bug is fixed since 4.0.14 (3.2.47) + +------------------------------------------------------------------- Sun Nov 11 16:29:30 UTC 2018 - knut.anders...@suse.com - Yast::Lan: Added method for obtaining the NTP servers offered by diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.1.17/package/yast2-network.spec new/yast2-network-4.1.18/package/yast2-network.spec --- old/yast2-network-4.1.17/package/yast2-network.spec 2018-11-15 09:53:16.000000000 +0100 +++ new/yast2-network-4.1.18/package/yast2-network.spec 2018-11-26 12:54:27.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.1.17 +Version: 4.1.18 Release: 0 BuildArch: noarch diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.1.17/src/include/network/lan/address.rb new/yast2-network-4.1.18/src/include/network/lan/address.rb --- old/yast2-network-4.1.17/src/include/network/lan/address.rb 2018-11-15 09:53:16.000000000 +0100 +++ new/yast2-network-4.1.18/src/include/network/lan/address.rb 2018-11-26 12:54:27.000000000 +0100 @@ -39,7 +39,6 @@ textdomain "network" - Yast.import "Arch" Yast.import "CWM" Yast.import "CWMTab" Yast.import "DNS" @@ -57,7 +56,6 @@ Yast.import "String" Yast.import "SuSEFirewall4Network" Yast.import "Wizard" - Yast.import "NetworkService" Yast.import "Map" Yast.include include_target, "network/summary.rb" @@ -950,20 +948,6 @@ true end - # Validator for network masks adresses - # @param key [String] the widget being validated - # @param _event [Hash] the event being handled - # @return whether valid - def ValidateNetmask(key, _event) - # TODO: general CWM improvement idea: validate and save only nondisabled - # widgets - if UI.QueryWidget(:bootproto, :CurrentButton) == :static - ipa = Convert.to_string(UI.QueryWidget(Id(key), :Value)) - return Netmask.Check(ipa) - end - true - end - # Validator for ifcfg names # @param key [String] the widget being validated # @param _event [Hash] the event being handled @@ -1533,10 +1517,20 @@ return if !(ip_changed || hostname_changed || hostname.empty?) - log.info("Dropping record for #{LanItems.ipaddr} from /etc/hosts") - + # store old names, remove the record + names = Host.names(LanItems.ipaddr).first Host.remove_ip(LanItems.ipaddr) - Host.Update(initial_hostname, hostname, ipaddr) if !hostname.empty? + + if ip_changed && !hostname_changed + log.info("Dropping record for #{LanItems.ipaddr} from /etc/hosts") + + Host.add_name(ipaddr, names) + end + if !hostname.empty? && hostname_changed + log.info("Updating cannonical name for #{LanItems.ipaddr} in /etc/hosts") + + Host.Update(initial_hostname, hostname, ipaddr) + end nil end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.1.17/src/include/network/lan/help.rb new/yast2-network-4.1.18/src/include/network/lan/help.rb --- old/yast2-network-4.1.17/src/include/network/lan/help.rb 2018-11-15 09:53:16.000000000 +0100 +++ new/yast2-network-4.1.18/src/include/network/lan/help.rb 2018-11-26 12:54:27.000000000 +0100 @@ -220,7 +220,8 @@ _( "<p>For <b>Static Address Setup</b> enter the static IP address for your computer (for example: <tt>192.168.100.99</tt>) and\n" \ "the network mask (usually <tt>255.255.255.0</tt> or just length of prefix <tt>/24</tt>).Optionally, you can enter\n" \ - "a fully qualified hostname for this IP address. The hostname will be written to <tt>/etc/hosts</tt>.</p>\n" + "a fully qualified hostname for this IP address. The hostname will be written to <tt>/etc/hosts</tt> as canonical name.</p>\n" \ + "YaST2 will also create aliases from the canonical name automatically.\n" ) + # Address dialog help 8/8 _( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.1.17/test/address_test.rb new/yast2-network-4.1.18/test/address_test.rb --- old/yast2-network-4.1.17/test/address_test.rb 2018-11-15 09:53:16.000000000 +0100 +++ new/yast2-network-4.1.18/test/address_test.rb 2018-11-26 12:54:27.000000000 +0100 @@ -90,14 +90,23 @@ let(:initial_hostname) { "initial.hostname.com" } let(:new_hostname) { "new.hostname.com" } - it "drops old /etc/hosts record if hostname was changed" do + before(:each) do allow(Yast::LanItems) .to receive(:ipaddr) .and_return(ip) allow(subject) .to receive(:initial_hostname) .and_return(initial_hostname) + allow(Yast::Host) + .to receive(:names) + .and_call_original + allow(Yast::Host) + .to receive(:names) + .with(ip) + .and_return(["#{initial_hostname} custom-name"]) + end + it "drops old /etc/hosts record if hostname was changed" do expect(Yast::Host) .to receive(:remove_ip) .with(ip) @@ -107,6 +116,15 @@ subject.send(:update_hostname, ip, new_hostname) end + + it "keeps names untouched when only the ip was changed" do + new_ip = "2.2.2.2" + + original_names = Yast::Host.names(ip) + subject.send(:update_hostname, new_ip, initial_hostname) + + expect(Yast::Host.names(new_ip)).to eql original_names + end end end