Hello community, here is the log from the commit of package yast2-network for openSUSE:Leap:15.2 checked in at 2020-03-26 05:40:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/yast2-network (Old) and /work/SRC/openSUSE:Leap:15.2/.yast2-network.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-network" Thu Mar 26 05:40:55 2020 rev:124 rq:787740 version:4.2.63 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/yast2-network/yast2-network.changes 2020-03-13 10:55:54.460371900 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.yast2-network.new.3160/yast2-network.changes 2020-03-26 05:40:57.719265816 +0100 @@ -1,0 +2,16 @@ +Thu Mar 19 13:52:31 UTC 2020 - Knut Anderssen <[email protected]> + +- AutoYaST: do not crash when defined dns section whitout hostname + (bsc#1166953) +- AutoYaST: handle the dhcp_hostname option in the dns section + correctly +- 4.2.63 + +------------------------------------------------------------------- +Wed Mar 18 09:42:36 UTC 2020 - Knut Anderssen <[email protected]> + +- Do a reload of configured interfaces when writing the + configuration during a ssh or vnc installation (bsc#1166287) +- 4.2.62 + +------------------------------------------------------------------- Old: ---- yast2-network-4.2.61.tar.bz2 New: ---- yast2-network-4.2.63.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.ACa5rs/_old 2020-03-26 05:40:58.119266023 +0100 +++ /var/tmp/diff_new_pack.ACa5rs/_new 2020-03-26 05:40:58.123266025 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.2.61 +Version: 4.2.63 Release: 0 Summary: YaST2 - Network Configuration License: GPL-2.0-only ++++++ yast2-network-4.2.61.tar.bz2 -> yast2-network-4.2.63.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.61/package/yast2-network.changes new/yast2-network-4.2.63/package/yast2-network.changes --- old/yast2-network-4.2.61/package/yast2-network.changes 2020-03-10 16:13:28.000000000 +0100 +++ new/yast2-network-4.2.63/package/yast2-network.changes 2020-03-20 23:08:58.000000000 +0100 @@ -1,4 +1,20 @@ ------------------------------------------------------------------- +Thu Mar 19 13:52:31 UTC 2020 - Knut Anderssen <[email protected]> + +- AutoYaST: do not crash when defined dns section whitout hostname + (bsc#1166953) +- AutoYaST: handle the dhcp_hostname option in the dns section + correctly +- 4.2.63 + +------------------------------------------------------------------- +Wed Mar 18 09:42:36 UTC 2020 - Knut Anderssen <[email protected]> + +- Do a reload of configured interfaces when writing the + configuration during a ssh or vnc installation (bsc#1166287) +- 4.2.62 + +------------------------------------------------------------------- Tue Mar 10 14:29:36 UTC 2020 - Josef Reidinger <[email protected]> - Store ip forwarding set during installation to target system diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.61/package/yast2-network.spec new/yast2-network-4.2.63/package/yast2-network.spec --- old/yast2-network-4.2.61/package/yast2-network.spec 2020-03-10 16:13:28.000000000 +0100 +++ new/yast2-network-4.2.63/package/yast2-network.spec 2020-03-20 23:08:58.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.2.61 +Version: 4.2.63 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.61/src/lib/y2network/autoinst/hostname_reader.rb new/yast2-network-4.2.63/src/lib/y2network/autoinst/hostname_reader.rb --- old/yast2-network-4.2.61/src/lib/y2network/autoinst/hostname_reader.rb 2020-03-10 16:13:28.000000000 +0100 +++ new/yast2-network-4.2.63/src/lib/y2network/autoinst/hostname_reader.rb 2020-03-20 23:08:58.000000000 +0100 @@ -39,19 +39,33 @@ # @return [Hostname] the imported {Hostname} config def config Y2Network::Hostname.new( - dhcp_hostname: section.dhcp_hostname, - static: section.hostname || default_hostname, + dhcp_hostname: dhcp_hostname_for(section.dhcp_hostname), + static: section.hostname || static_hostname, installer: section.hostname ) end private - # Returns a default hostname proposal for installer + # Returns the current static_hostname # # @return [String] - def default_hostname - Y2Network::Sysconfig::HostnameReader.new.hostname + def static_hostname + Y2Network::Sysconfig::HostnameReader.new.static_hostname + end + + # Returns the value for the dhcp_hostname option selected in the profile. + # If the option is not present then it is read from the system + # + # @return [String] + def dhcp_hostname_for(section_value) + # The autoyast network configuration is usually merge with current + # config, but we do not want to override current config if the value is + # not present and the merge is missing for whatever reason, for example + # in case AutoYaST is called in config mode + return Y2Network::Sysconfig::HostnameReader.new.dhcp_hostname if section_value.nil? + + section_value ? :any : :none end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.61/src/lib/y2network/sysconfig/hostname_reader.rb new/yast2-network-4.2.63/src/lib/y2network/sysconfig/hostname_reader.rb --- old/yast2-network-4.2.61/src/lib/y2network/sysconfig/hostname_reader.rb 2020-03-10 16:13:28.000000000 +0100 +++ new/yast2-network-4.2.63/src/lib/y2network/sysconfig/hostname_reader.rb 2020-03-20 23:08:58.000000000 +0100 @@ -106,12 +106,19 @@ nil end - # Reads the system (local) hostname + # Reads the transient hostname or system (local) hostname # # @return [String, nil] Hostname def hostname_from_system Yast::Execute.on_target!("/usr/bin/hostname", stdout: :capture).strip rescue Cheetah::ExecutionFailed + static_hostname + end + + # Reads the static hostname from /etc/hostname + # + # @return [String, nil] + def static_hostname name = Yast::SCR.Read(Yast::Path.new(".target.string"), "/etc/hostname").to_s.strip name.empty? ? nil : name end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.61/src/lib/y2network/sysconfig/hostname_writer.rb new/yast2-network-4.2.63/src/lib/y2network/sysconfig/hostname_writer.rb --- old/yast2-network-4.2.61/src/lib/y2network/sysconfig/hostname_writer.rb 2020-03-10 16:13:28.000000000 +0100 +++ new/yast2-network-4.2.63/src/lib/y2network/sysconfig/hostname_writer.rb 2020-03-20 23:08:58.000000000 +0100 @@ -73,7 +73,7 @@ # # @param hostname [Y2Network::Hostname] Hostname configuration def update_hostname(hostname) - hostname = hostname.static + hostname = hostname.static.to_s # 1) when user asked for erasing hostname from /etc/hostname, we keep runtime as it is # 2) we will write whatever user wants even FQDN - no changes under the hood Yast::Execute.locally!("/usr/bin/hostname", hostname) if !hostname.empty? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.61/src/modules/Lan.rb new/yast2-network-4.2.63/src/modules/Lan.rb --- old/yast2-network-4.2.61/src/modules/Lan.rb 2020-03-10 16:13:28.000000000 +0100 +++ new/yast2-network-4.2.63/src/modules/Lan.rb 2020-03-20 23:08:58.000000000 +0100 @@ -44,6 +44,7 @@ module Yast class LanClass < Module include ::UI::TextHelpers + include Wicked def main Yast.import "UI" @@ -876,14 +877,14 @@ NetworkService.ReloadOrRestart if Stage.normal || !Linuxrc.usessh when :remote_installer - ifaces = LanItems.getNetworkInterfaces + connection_names = yast_config&.connections&.map(&:name) || [] # last instance handling "special" cases like ssh installation # FIXME: most probably not everything will be set properly log.info("Running in ssh/vnc installer -> just setting links up") - log.info("Available interfaces: #{ifaces}") + log.info("Configured connections: #{connection_names}") - LanItems.reload_config(ifaces) + reload_config(connection_names) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.61/test/lan_test.rb new/yast2-network-4.2.63/test/lan_test.rb --- old/yast2-network-4.2.61/test/lan_test.rb 2020-03-10 16:13:28.000000000 +0100 +++ new/yast2-network-4.2.63/test/lan_test.rb 2020-03-20 23:08:58.000000000 +0100 @@ -80,13 +80,21 @@ end describe "#activate_network_service" do + Yast.import "Stage" Yast.import "NetworkService" + let(:yast_config) { instance_double(Y2Network::Config, "YaST", connections: collection) } + let(:collection) { [eth0, eth1] } + + let(:eth0) { Y2Network::ConnectionConfig::Ethernet.new.tap { |c| c.name = "eth0" } } + let(:eth1) { Y2Network::ConnectionConfig::Ethernet.new.tap { |c| c.name = "eth1" } } + let(:force_restart) { false } let(:installation) { false } before do + subject.add_config(:yast, yast_config) allow(Yast::LanItems).to receive(:force_restart).and_return(force_restart) allow(Yast::Stage).to receive(:normal).and_return(!installation) allow(Yast::Stage).to receive(:initial).and_return(installation) @@ -125,17 +133,21 @@ context "when asked during installation" do let(:installation) { true } - it "updates network service according usessh flag" do - if ssh_flag - expect(Yast::NetworkService) - .not_to receive(:ReloadOrRestart) - else + if ssh_flag + it "reloads configured connections" do + expect(subject).to receive(:reload_config).with(["eth0", "eth1"]) + + Yast::Lan.send(:activate_network_service) + end + else + it "tries to reload or restart the networkservice" do expect(Yast::NetworkService) .to receive(:ReloadOrRestart) - end - Yast::Lan.send(:activate_network_service) + Yast::Lan.send(:activate_network_service) + end end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.61/test/y2network/autoinst/config_reader_test.rb new/yast2-network-4.2.63/test/y2network/autoinst/config_reader_test.rb --- old/yast2-network-4.2.61/test/y2network/autoinst/config_reader_test.rb 2020-03-10 16:13:28.000000000 +0100 +++ new/yast2-network-4.2.63/test/y2network/autoinst/config_reader_test.rb 2020-03-20 23:08:58.000000000 +0100 @@ -58,7 +58,8 @@ "ipv4_forward" => true, "ipv6_forward" => false, "routes" => routes - } + }, + "dns" => dns } end @@ -67,6 +68,8 @@ expect(subject.config).to be_a Y2Network::Config expect(subject.config.routing).to be_a Y2Network::Routing expect(subject.config.dns).to be_a Y2Network::DNS + expect(subject.config.hostname.dhcp_hostname).to eq(:any) + expect(subject.config.hostname.installer).to eq("host") end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.2.61/test/y2network/autoinst/hostname_reader_test.rb new/yast2-network-4.2.63/test/y2network/autoinst/hostname_reader_test.rb --- old/yast2-network-4.2.61/test/y2network/autoinst/hostname_reader_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-network-4.2.63/test/y2network/autoinst/hostname_reader_test.rb 2020-03-20 23:08:58.000000000 +0100 @@ -0,0 +1,76 @@ +#!/usr/bin/env rspec + +# Copyright (c) [2020] 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/hostname_reader" + +describe Y2Network::Autoinst::HostnameReader do + let(:subject) { described_class.new(dns_section) } + + let(:dns_section) do + Y2Network::AutoinstProfile::DNSSection.new_from_hashes(profile["dns"]) + end + + let(:current_static_hostname) { "test" } + let(:current_dhcp_hostname) { :any } + + before do + allow_any_instance_of(Y2Network::Sysconfig::HostnameReader) + .to receive(:static_hostname).and_return(current_static_hostname) + allow_any_instance_of(Y2Network::Sysconfig::HostnameReader) + .to receive(:dhcp_hostname).and_return(current_dhcp_hostname) + end + + let(:profile) do + { + "dns" => { + "hostname" => "host", + "dhcp_hostname" => false, "write_hostname" => true + } + } + end + + describe "#config" do + it "builds a new Y2Network::Hostname config from the profile dns section" do + config = subject.config + expect(config).to be_a Y2Network::Hostname + expect(config.installer).to eq("host") + expect(config.dhcp_hostname).to eq(:none) + expect(config.static).to eq("host") + end + + context "when no hostname option is defined" do + let(:profile) { { "dns" => { "dhcp_hostname" => true } } } + + it "reads the current hostname configuration from the system" do + expect(subject.config.hostname).to eq(current_static_hostname) + end + end + + context "when no dhcp_hostname option is defined" do + let(:profile) { { "dns" => { "hostname" => "another_host" } } } + + it "reads the current dhcp_hostname configuration from the system" do + expect(subject.config.dhcp_hostname).to eq(current_dhcp_hostname) + end + end + end +end
