Hello community, here is the log from the commit of package yast2-caasp for openSUSE:Factory checked in at 2018-11-18 22:59:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-caasp (Old) and /work/SRC/openSUSE:Factory/.yast2-caasp.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2-caasp" Sun Nov 18 22:59:39 2018 rev:8 rq:648769 version:4.1.2 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-caasp/yast2-caasp.changes 2018-11-01 19:05:58.906020804 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-caasp.new/yast2-caasp.changes 2018-11-18 23:00:17.163661584 +0100 @@ -1,0 +2,9 @@ +Fri Nov 9 16:09:30 UTC 2018 - lslezak@suse.cz + +- Kubic updates (bsc#1114818) + - Propose using the openSUSE pool.ntp.org servers when the DHCP + response does not include any + - Updated kubeadm dialog title +- 4.1.2 + +------------------------------------------------------------------- Old: ---- yast2-caasp-4.1.1.tar.bz2 New: ---- yast2-caasp-4.1.2.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-caasp.spec ++++++ --- /var/tmp/diff_new_pack.9hVJHV/_old 2018-11-18 23:00:20.723657597 +0100 +++ /var/tmp/diff_new_pack.9hVJHV/_new 2018-11-18 23:00:20.727657591 +0100 @@ -17,7 +17,7 @@ Name: yast2-caasp -Version: 4.1.1 +Version: 4.1.2 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-caasp-4.1.1.tar.bz2 -> yast2-caasp-4.1.2.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-caasp-4.1.1/README.md new/yast2-caasp-4.1.2/README.md --- old/yast2-caasp-4.1.1/README.md 2018-10-26 17:23:07.000000000 +0200 +++ new/yast2-caasp-4.1.2/README.md 2018-11-13 17:44:07.000000000 +0100 @@ -7,7 +7,7 @@ [![Code Climate](https://codeclimate.com/github/yast/yast-caasp/badges/gpa.svg)](https://codeclimate.com/github/yast/yast-caasp) This repository contains code which is specific for the [Containers as a Service Platform -(CaaSP)](https://www.suse.com/documentation/suse-caasp-3/index.html) product and +(CaaSP)](https://www.suse.com/documentation/suse-caasp/) product and the [openSUSE Kubic](https://kubic.opensuse.org/) project. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-caasp-4.1.1/package/yast2-caasp.changes new/yast2-caasp-4.1.2/package/yast2-caasp.changes --- old/yast2-caasp-4.1.1/package/yast2-caasp.changes 2018-10-26 17:23:07.000000000 +0200 +++ new/yast2-caasp-4.1.2/package/yast2-caasp.changes 2018-11-13 17:44:07.000000000 +0100 @@ -1,4 +1,13 @@ ------------------------------------------------------------------- +Fri Nov 9 16:09:30 UTC 2018 - lslezak@suse.cz + +- Kubic updates (bsc#1114818) + - Propose using the openSUSE pool.ntp.org servers when the DHCP + response does not include any + - Updated kubeadm dialog title +- 4.1.2 + +------------------------------------------------------------------- Thu Oct 25 14:06:41 UTC 2018 - lslezak@suse.cz - Added Kubeadm role dialog for openSUSE Kubic (FATE#325834) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-caasp-4.1.1/package/yast2-caasp.spec new/yast2-caasp-4.1.2/package/yast2-caasp.spec --- old/yast2-caasp-4.1.1/package/yast2-caasp.spec 2018-10-26 17:23:07.000000000 +0200 +++ new/yast2-caasp-4.1.2/package/yast2-caasp.spec 2018-11-13 17:44:07.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-caasp -Version: 4.1.1 +Version: 4.1.2 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-caasp-4.1.1/src/clients/inst_kubic_kubeadm_role.rb new/yast2-caasp-4.1.2/src/clients/inst_kubic_kubeadm_role.rb --- old/yast2-caasp-4.1.1/src/clients/inst_kubic_kubeadm_role.rb 2018-10-26 17:23:07.000000000 +0200 +++ new/yast2-caasp-4.1.2/src/clients/inst_kubic_kubeadm_role.rb 2018-11-13 17:44:07.000000000 +0100 @@ -1,4 +1,3 @@ -# so far the Kubic dialog is the same as in CaaSP -require "y2caasp/clients/admin_role_dialog" -Y2Caasp::AdminRoleDialog.new.run +require "y2caasp/clients/kubeadm_role_dialog" +Y2Caasp::KubeadmRoleDialog.new.run diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-caasp-4.1.1/src/lib/y2caasp/clients/admin_role_dialog.rb new/yast2-caasp-4.1.2/src/lib/y2caasp/clients/admin_role_dialog.rb --- old/yast2-caasp-4.1.1/src/lib/y2caasp/clients/admin_role_dialog.rb 2018-10-26 17:23:07.000000000 +0200 +++ new/yast2-caasp-4.1.2/src/lib/y2caasp/clients/admin_role_dialog.rb 2018-11-13 17:44:07.000000000 +0100 @@ -19,6 +19,7 @@ # current contact information at www.suse.com. # ------------------------------------------------------------------------------ +require "yast" require "cwm/dialog" require "y2caasp/widgets/ntp_server" require "y2caasp/dhcp_ntp_servers" @@ -32,10 +33,19 @@ def initialize textdomain "caasp" + + Yast.import "Product" + Yast.import "ProductFeatures" super end + # + # The dialog title + # + # @return [String] the title + # def title + # TRANSLATORS: dialog title _("Admin Node Configuration") end @@ -45,8 +55,47 @@ @content = HSquash( MinWidth(50, # preselect the servers from the DHCP response - Y2Caasp::Widgets::NtpServer.new(dhcp_ntp_servers)) + 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.1.1/src/lib/y2caasp/clients/kubeadm_role_dialog.rb new/yast2-caasp-4.1.2/src/lib/y2caasp/clients/kubeadm_role_dialog.rb --- old/yast2-caasp-4.1.1/src/lib/y2caasp/clients/kubeadm_role_dialog.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-caasp-4.1.2/src/lib/y2caasp/clients/kubeadm_role_dialog.rb 2018-11-13 17:44:07.000000000 +0100 @@ -0,0 +1,27 @@ +require "yast" + +# so far the Kubic dialog is the same as in CaaSP, +# just with different title and defaults +require "y2caasp/clients/admin_role_dialog" + +module Y2Caasp + # This library provides a simple dialog for setting + # the kubeadm role specific settings: + # - the NTP server names + class KubeadmRoleDialog < AdminRoleDialog + def initialize + textdomain "caasp" + super + end + + # + # The dialog title + # + # @return [String] the title + # + def title + # TRANSLATORS: dialog title + _("kubeadm Node Configuration") + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-caasp-4.1.1/src/lib/y2caasp/dhcp_ntp_servers.rb new/yast2-caasp-4.1.2/src/lib/y2caasp/dhcp_ntp_servers.rb --- old/yast2-caasp-4.1.1/src/lib/y2caasp/dhcp_ntp_servers.rb 2018-10-26 17:23:07.000000000 +0200 +++ new/yast2-caasp-4.1.2/src/lib/y2caasp/dhcp_ntp_servers.rb 2018-11-13 17:44:07.000000000 +0100 @@ -17,8 +17,10 @@ # current contact information at www.suse.com. # ------------------------------------------------------------------------------ +require "yast" + module Y2Caasp - # This module provides a functionlity for reading the NTP servers + # This module provides a functionality for reading the NTP servers # from the DHCP response module DhcpNtpServers # @@ -37,7 +39,7 @@ # interfaces e.g. using a bash command or initialize whole networking module. Yast::Lan.ReadWithCacheNoGUI - Yast::LanItems.dhcp_ntp_servers.values.reduce(&:concat) || [] + Yast::LanItems.dhcp_ntp_servers.values.flatten.uniq end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-caasp-4.1.1/test/lib/y2caasp/clients/admin_role_dialog_test.rb new/yast2-caasp-4.1.2/test/lib/y2caasp/clients/admin_role_dialog_test.rb --- old/yast2-caasp-4.1.1/test/lib/y2caasp/clients/admin_role_dialog_test.rb 2018-10-26 17:23:07.000000000 +0200 +++ new/yast2-caasp-4.1.2/test/lib/y2caasp/clients/admin_role_dialog_test.rb 2018-11-13 17:44:07.000000000 +0100 @@ -20,9 +20,29 @@ 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 + 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"]) + end + + it "proposes to use a random novell pool server" 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/) + original.call(arg) + end + subject.run + end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-caasp-4.1.1/test/lib/y2caasp/clients/kubeadm_role_dialog_test.rb new/yast2-caasp-4.1.2/test/lib/y2caasp/clients/kubeadm_role_dialog_test.rb --- old/yast2-caasp-4.1.1/test/lib/y2caasp/clients/kubeadm_role_dialog_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-caasp-4.1.2/test/lib/y2caasp/clients/kubeadm_role_dialog_test.rb 2018-11-13 17:44:07.000000000 +0100 @@ -0,0 +1,46 @@ +#! /usr/bin/env rspec + +require_relative "../../../test_helper.rb" +require_relative "role_dialog_examples" +require "cwm/rspec" + +require "y2caasp/clients/kubeadm_role_dialog.rb" + +Yast.import "CWM" +Yast.import "Lan" +Yast.import "Wizard" + +describe Y2Caasp::KubeadmRoleDialog 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" + + context "no NTP server set in DHCP and default NTP is enabled in control.xml" do + 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"]) + end + + it "proposes to use a random openSUSE pool server" 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/) + original.call(arg) + end + subject.run + end + end + end +end