Hello community, here is the log from the commit of package yast2-caasp for openSUSE:Factory checked in at 2020-03-01 21:26:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-caasp (Old) and /work/SRC/openSUSE:Factory/.yast2-caasp.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-caasp" Sun Mar 1 21:26:49 2020 rev:12 rq:777773 version:4.2.3 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-caasp/yast2-caasp.changes 2019-08-27 15:53:28.167709366 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-caasp.new.26092/yast2-caasp.changes 2020-03-01 21:26:57.696428207 +0100 @@ -1,0 +2,6 @@ +Wed Feb 19 12:57:29 UTC 2020 - Imobach Gonzalez Sosa <[email protected]> + +- Rely on the new Y2Network::NtpServer class (jsc#SLE-7188). +- 4.2.3 + +------------------------------------------------------------------- Old: ---- yast2-caasp-4.2.2.tar.bz2 New: ---- yast2-caasp-4.2.3.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-caasp.spec ++++++ --- /var/tmp/diff_new_pack.KxMcWt/_old 2020-03-01 21:26:59.932432749 +0100 +++ /var/tmp/diff_new_pack.KxMcWt/_new 2020-03-01 21:26:59.940432765 +0100 @@ -1,7 +1,7 @@ # # spec file for package yast2-caasp # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: yast2-caasp -Version: 4.2.2 +Version: 4.2.3 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -32,9 +32,9 @@ # chrony support Requires: yast2-ntp-client >= 4.0.3 BuildRequires: yast2-ntp-client >= 4.0.3 -# parsing dhcp leases (ntp) -Requires: yast2-network >= 4.1.11 -BuildRequires: yast2-network >= 4.1.11 +# Y2Network::NtpServer +Requires: yast2-network >= 4.2.55 +BuildRequires: yast2-network >= 4.2.55 BuildRequires: yast2-devtools >= 3.1.39 BuildRequires: rubygem(%{rb_default_ruby_abi}:rspec) ++++++ yast2-caasp-4.2.2.tar.bz2 -> yast2-caasp-4.2.3.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-caasp-4.2.2/package/yast2-caasp.changes new/yast2-caasp-4.2.3/package/yast2-caasp.changes --- old/yast2-caasp-4.2.2/package/yast2-caasp.changes 2019-08-26 09:46:48.000000000 +0200 +++ new/yast2-caasp-4.2.3/package/yast2-caasp.changes 2020-02-20 21:21:38.000000000 +0100 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Wed Feb 19 12:57:29 UTC 2020 - Imobach Gonzalez Sosa <[email protected]> + +- Rely on the new Y2Network::NtpServer class (jsc#SLE-7188). +- 4.2.3 + +------------------------------------------------------------------- Mon Aug 26 09:31:45 CEST 2019 - [email protected] - Using rb_default_ruby_abi tag in the spec file in order to diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-caasp-4.2.2/package/yast2-caasp.spec new/yast2-caasp-4.2.3/package/yast2-caasp.spec --- old/yast2-caasp-4.2.2/package/yast2-caasp.spec 2019-08-26 09:46:48.000000000 +0200 +++ new/yast2-caasp-4.2.3/package/yast2-caasp.spec 2020-02-20 21:21:38.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-caasp -Version: 4.2.2 +Version: 4.2.3 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -32,9 +32,9 @@ # chrony support Requires: yast2-ntp-client >= 4.0.3 BuildRequires: yast2-ntp-client >= 4.0.3 -# parsing dhcp leases (ntp) -Requires: yast2-network >= 4.1.11 -BuildRequires: yast2-network >= 4.1.11 +# Y2Network::NtpServer +Requires: yast2-network >= 4.2.55 +BuildRequires: yast2-network >= 4.2.55 BuildRequires: yast2-devtools >= 3.1.39 BuildRequires: rubygem(%{rb_default_ruby_abi}:rspec) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-caasp-4.2.2/src/lib/y2caasp/clients/admin_role_dialog.rb new/yast2-caasp-4.2.3/src/lib/y2caasp/clients/admin_role_dialog.rb --- old/yast2-caasp-4.2.2/src/lib/y2caasp/clients/admin_role_dialog.rb 2019-08-26 09:46:48.000000000 +0200 +++ new/yast2-caasp-4.2.3/src/lib/y2caasp/clients/admin_role_dialog.rb 2020-02-20 21:21:38.000000000 +0100 @@ -23,6 +23,7 @@ require "cwm/dialog" require "y2caasp/widgets/ntp_server" require "y2caasp/dhcp_ntp_servers" +require "y2network/ntp_server" module Y2Caasp # This library provides a simple dialog for setting @@ -58,44 +59,5 @@ Y2Caasp::Widgets::NtpServer.new(ntp_servers)) ) end - - private - - # - # Propose the NTP servers from the DHCP response, fallback to a random - # machine from the ntp.org pool if enabled in control.xml. - # - # @return [Array<String>] proposed NTP servers, empty if nothing suitable found - # - def ntp_servers - # TODO: use Yast::NtpClient.ntp_conf if configured - # to better handle going back - servers = dhcp_ntp_servers - servers = ntp_fallback if servers.empty? - - servers - end - - # - # The fallback servers for NTP configuration - # - # @return [Array<String>] the fallback servers, empty if disabled in control.xml - # - def ntp_fallback - # propose the fallback when enabled in control file - return [] unless Yast::ProductFeatures.GetBooleanFeature("globals", "default_ntp_setup") - - # copied from timezone/dialogs.rb: - base_products = Yast::Product.FindBaseProducts - host = if base_products.any? { |p| p["name"] =~ /openSUSE/i } - "opensuse" - else - # TODO: use a SUSE server when available in the future - "novell" - end - - # propose a random pool server in range 0..3 - ["#{rand(4)}.#{host}.pool.ntp.org"] - end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-caasp-4.2.2/src/lib/y2caasp/clients/kubic_minion_role_dialog.rb new/yast2-caasp-4.2.3/src/lib/y2caasp/clients/kubic_minion_role_dialog.rb --- old/yast2-caasp-4.2.2/src/lib/y2caasp/clients/kubic_minion_role_dialog.rb 2019-08-26 09:46:48.000000000 +0200 +++ new/yast2-caasp-4.2.3/src/lib/y2caasp/clients/kubic_minion_role_dialog.rb 2020-02-20 21:21:38.000000000 +0100 @@ -23,6 +23,7 @@ require "y2caasp/widgets/kubic_admin_node" require "y2caasp/widgets/ntp_server" require "y2caasp/dhcp_ntp_servers" +require "y2network/ntp_server" module Y2Caasp # This library provides a simple dialog for setting @@ -58,44 +59,5 @@ )) ) end - - private - - # - # Propose the NTP servers from the DHCP response, fallback to a random - # machine from the ntp.org pool if enabled in control.xml. - # - # @return [Array<String>] proposed NTP servers, empty if nothing suitable found - # - def ntp_servers - # TODO: use Yast::NtpClient.ntp_conf if configured - # to better handle going back - servers = dhcp_ntp_servers - servers = ntp_fallback if servers.empty? - - servers - end - - # - # The fallback servers for NTP configuration - # - # @return [Array<String>] the fallback servers, empty if disabled in control.xml - # - def ntp_fallback - # propose the fallback when enabled in control file - return [] unless Yast::ProductFeatures.GetBooleanFeature("globals", "default_ntp_setup") - - # copied from timezone/dialogs.rb: - base_products = Yast::Product.FindBaseProducts - host = if base_products.any? { |p| p["name"] =~ /openSUSE/i } - "opensuse" - else - # TODO: use a SUSE server when available in the future - "novell" - end - - # propose a random pool server in range 0..3 - ["#{rand(4)}.#{host}.pool.ntp.org"] - end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-caasp-4.2.2/src/lib/y2caasp/dhcp_ntp_servers.rb new/yast2-caasp-4.2.3/src/lib/y2caasp/dhcp_ntp_servers.rb --- old/yast2-caasp-4.2.2/src/lib/y2caasp/dhcp_ntp_servers.rb 2019-08-26 09:46:48.000000000 +0200 +++ new/yast2-caasp-4.2.3/src/lib/y2caasp/dhcp_ntp_servers.rb 2020-02-20 21:21:38.000000000 +0100 @@ -21,7 +21,6 @@ module Y2Caasp # This module provides a functionality for reading the NTP servers - # from the DHCP response module DhcpNtpServers # # List of NTP servers from DHCP @@ -41,5 +40,35 @@ Yast::LanItems.dhcp_ntp_servers.values.flatten.uniq end + + # + # Propose the NTP servers from the DHCP response, fallback to a random + # machine from the ntp.org pool if enabled in control.xml. + # + # @return [Array<String>] proposed NTP servers, empty if nothing suitable found + # + def ntp_servers + # TODO: use Yast::NtpClient.ntp_conf if configured + # to better handle going back + servers = dhcp_ntp_servers + servers = ntp_fallback if servers.empty? + + servers + end + + # + # The fallback servers for NTP configuration + # + # @return [Array<String>] the fallback servers, empty if disabled in control.xml + # + def ntp_fallback + # propose the fallback when enabled in control file + return [] unless Yast::ProductFeatures.GetBooleanFeature("globals", "default_ntp_setup") + + default_servers = Y2Network::NtpServer.default_servers + return [] if default_servers.empty? + + [default_servers.sample.hostname] + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-caasp-4.2.2/test/lib/y2caasp/clients/admin_role_dialog_test.rb new/yast2-caasp-4.2.3/test/lib/y2caasp/clients/admin_role_dialog_test.rb --- old/yast2-caasp-4.2.2/test/lib/y2caasp/clients/admin_role_dialog_test.rb 2019-08-26 09:46:48.000000000 +0200 +++ new/yast2-caasp-4.2.3/test/lib/y2caasp/clients/admin_role_dialog_test.rb 2020-02-20 21:21:38.000000000 +0100 @@ -4,7 +4,7 @@ require_relative "role_dialog_examples" require "cwm/rspec" -require "y2caasp/clients/admin_role_dialog.rb" +require "y2caasp/clients/admin_role_dialog" Yast.import "CWM" Yast.import "Lan" @@ -29,16 +29,23 @@ # Note: this is a hypothetical test, in real CaaSP the default NTP setup # is currently disabled in control.xml context "no NTP server set in DHCP and default NTP is enabled in control.xml" do + let(:default_servers) do + [ + Y2Network::NtpServer.new("0.suse.pool.ntp.org"), + Y2Network::NtpServer.new("1.suse.pool.ntp.org") + ] + end + before do allow(Yast::ProductFeatures).to receive(:GetBooleanFeature) .with("globals", "default_ntp_setup").and_return(true) - allow(Yast::Product).to receive(:FindBaseProducts) - .and_return(["name" => "CAASP"]) + allow(Y2Network::NtpServer).to receive(:default_servers).and_return(default_servers) end - it "proposes to use a random novell pool server" do + it "proposes to use a random server from the default pool" do expect(Y2Caasp::Widgets::NtpServer).to receive(:new).and_wrap_original do |original, arg| - expect(arg.first).to match(/\A[0-3]\.novell\.pool\.ntp\.org\z/) + expect(arg.size).to eq(1) + expect(arg.first).to match(/suse.pool.ntp.org/) original.call(arg) end subject.run diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-caasp-4.2.2/test/lib/y2caasp/clients/kubeadm_role_dialog_test.rb new/yast2-caasp-4.2.3/test/lib/y2caasp/clients/kubeadm_role_dialog_test.rb --- old/yast2-caasp-4.2.2/test/lib/y2caasp/clients/kubeadm_role_dialog_test.rb 2019-08-26 09:46:48.000000000 +0200 +++ new/yast2-caasp-4.2.3/test/lib/y2caasp/clients/kubeadm_role_dialog_test.rb 2020-02-20 21:21:38.000000000 +0100 @@ -27,16 +27,22 @@ include_examples "NTP from DHCP" context "no NTP server set in DHCP and default NTP is enabled in control.xml" do + let(:default_servers) do + [ + Y2Network::NtpServer.new("0.suse.pool.ntp.org"), + Y2Network::NtpServer.new("1.suse.pool.ntp.org") + ] + end + before do allow(Yast::ProductFeatures).to receive(:GetBooleanFeature) .with("globals", "default_ntp_setup").and_return(true) - allow(Yast::Product).to receive(:FindBaseProducts) - .and_return(["name" => "openSUSE-Tumbleweed-Kubic"]) + allow(Y2Network::NtpServer).to receive(:default_servers).and_return(default_servers) end - it "proposes to use a random openSUSE pool server" do + it "proposes to use a random server from the default pool" do expect(Y2Caasp::Widgets::NtpServer).to receive(:new).and_wrap_original do |original, arg| - expect(arg.first).to match(/\A[0-3]\.opensuse\.pool\.ntp\.org\z/) + expect(default_servers.map(&:hostname)).to include(arg.first) original.call(arg) end subject.run diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-caasp-4.2.2/test/lib/y2caasp/clients/kubic_minion_role_dialog_test.rb new/yast2-caasp-4.2.3/test/lib/y2caasp/clients/kubic_minion_role_dialog_test.rb --- old/yast2-caasp-4.2.2/test/lib/y2caasp/clients/kubic_minion_role_dialog_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-caasp-4.2.3/test/lib/y2caasp/clients/kubic_minion_role_dialog_test.rb 2020-02-20 21:21:38.000000000 +0100 @@ -0,0 +1,72 @@ +# 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.rb" +require_relative "role_dialog_examples" +require "cwm/rspec" + +require "y2caasp/clients/kubic_minion_role_dialog" + +Yast.import "CWM" +Yast.import "Lan" +Yast.import "Wizard" + +describe ::Y2Caasp::KubicMinionRoleDialog do + describe "#run" do + let(:ntp_servers) { [] } + + before do + allow(Yast::Wizard).to receive(:CreateDialog) + allow(Yast::Wizard).to receive(:CloseDialog) + allow(Yast::CWM).to receive(:show).and_return(:next) + allow(Yast::Lan).to receive(:ReadWithCacheNoGUI) + allow(Yast::LanItems).to receive(:dhcp_ntp_servers).and_return({}) + allow(Yast::ProductFeatures).to receive(:GetBooleanFeature) + end + + include_examples "CWM::Dialog" + include_examples "NTP from DHCP" + + # Note: this is a hypothetical test, in real CaaSP the default NTP setup + # is currently disabled in control.xml + context "no NTP server set in DHCP and default NTP is enabled in control.xml" do + let(:default_servers) do + [ + Y2Network::NtpServer.new("0.suse.pool.ntp.org"), + Y2Network::NtpServer.new("1.suse.pool.ntp.org") + ] + end + + before do + allow(Yast::ProductFeatures).to receive(:GetBooleanFeature) + .with("globals", "default_ntp_setup").and_return(true) + allow(Y2Network::NtpServer).to receive(:default_servers).and_return(default_servers) + end + + it "proposes to use a random server from the default pool" do + expect(Y2Caasp::Widgets::NtpServer).to receive(:new).and_wrap_original do |original, arg| + expect(arg.size).to eq(1) + expect(arg.first).to match(/suse.pool.ntp.org/) + original.call(arg) + end + subject.run + end + end + end +end
