From 6e4c2c433bea3c168a7bea029e947acd5dcee7fb Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Tue, 15 Oct 2024 10:50:27 +0200 Subject: [PATCH 1/3] add additional dialog for microos to be able to drop yast2-caasp --- src/clients/inst_microos_role.rb | 3 + .../clients/microos_role_dialog.rb | 62 +++++++++++++++++ src/lib/installation/dhcp_ntp_servers.rb | 69 +++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 src/clients/inst_microos_role.rb create mode 100644 src/lib/installation/clients/microos_role_dialog.rb create mode 100644 src/lib/installation/dhcp_ntp_servers.rb diff --git a/src/clients/inst_microos_role.rb b/src/clients/inst_microos_role.rb new file mode 100644 index 000000000..acd6e2778 --- /dev/null +++ b/src/clients/inst_microos_role.rb @@ -0,0 +1,3 @@ + +require "installation/clients/microos_role_dialog" +Installation::MicroOSRoleDialog.new.run diff --git a/src/lib/installation/clients/microos_role_dialog.rb b/src/lib/installation/clients/microos_role_dialog.rb new file mode 100644 index 000000000..6f70b8e8c --- /dev/null +++ b/src/lib/installation/clients/microos_role_dialog.rb @@ -0,0 +1,62 @@ +# encoding: utf-8 + +# ------------------------------------------------------------------------------ +# Copyright (c) 2024 SUSE LLC +# +# +# 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. +# +# To contact SUSE about this file by physical or electronic mail, you may find +# current contact information at www.suse.com. +# ------------------------------------------------------------------------------ + +require "yast" +require "cwm/dialog" +require "installation/widgets/ntp_server" +require "installation/dhcp_ntp_servers" + +module Installation + # This library provides a simple dialog for setting + # the admin role specific settings: + # - the NTP server names + class AdminRoleDialog < CWM::Dialog + include DhcpNtpServers + + def initialize + textdomain "installation" + + Yast.import "Product" + Yast.import "ProductFeatures" + super + end + + # + # The dialog title + # + # @return [String] the title + # + def title + # TRANSLATORS: dialog title + _("NTP Configuration") + end + + def contents + return @content if @content + + @content = HSquash( + MinWidth(50, + # preselect the servers from the DHCP response + Installation::Widgets::NtpServer.new(ntp_servers)) + ) + end + end +end diff --git a/src/lib/installation/dhcp_ntp_servers.rb b/src/lib/installation/dhcp_ntp_servers.rb new file mode 100644 index 000000000..d9e090091 --- /dev/null +++ b/src/lib/installation/dhcp_ntp_servers.rb @@ -0,0 +1,69 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) 2017 SUSE LLC +# +# +# 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. +# +# To contact SUSE about this file by physical or electronic mail, you may find +# current contact information at www.suse.com. +# ------------------------------------------------------------------------------ + +require "yast" + +module Installation + # This module provides a functionality for reading the NTP servers + module DhcpNtpServers + # + # List of NTP servers from DHCP + # + # @return [Array] List of servers (IP or host names), empty if not provided + # + def dhcp_ntp_servers + Yast.import "Lan" + + Yast::Lan.dhcp_ntp_servers + 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] 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] the fallback servers, empty if disabled in control.xml + # + def ntp_fallback + Yast.import "ProductFeatures" + require "y2network/ntp_server" + + # 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 From 39b7a53c0eb3d12c5670d11c9c0a2eb20682866a Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Tue, 15 Oct 2024 11:01:16 +0200 Subject: [PATCH 2/3] changes --- package/yast2-installation.changes | 7 +++++++ package/yast2-installation.spec | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/package/yast2-installation.changes b/package/yast2-installation.changes index 513e18381..9c30ab1ae 100644 --- a/package/yast2-installation.changes +++ b/package/yast2-installation.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Oct 15 09:00:15 UTC 2024 - Josef Reidinger + +- Move microos system role dialog from yast2-caasp here to be able + to drop yast2-caasp (gh#yast/yast-caasp#49) +- 5.0.13 + ------------------------------------------------------------------- Mon Sep 9 12:33:25 UTC 2024 - Stefan Hundhammer diff --git a/package/yast2-installation.spec b/package/yast2-installation.spec index 110439083..1961f490b 100644 --- a/package/yast2-installation.spec +++ b/package/yast2-installation.spec @@ -16,7 +16,7 @@ # Name: yast2-installation -Version: 5.0.12 +Version: 5.0.13 Release: 0 Summary: YaST2 - Installation Parts License: GPL-2.0-only @@ -124,6 +124,9 @@ Conflicts: yast2-registration < 3.2.3 # Top bar with logo Conflicts: yast2-ycp-ui-bindings < 3.1.7 Obsoletes: yast2-installation-devel-doc +# we provide here only client that is used in microos from caasp package +# and those clients conflicts on file level +Conflicts: yast2-caasp <= 5.0.0 BuildArch: noarch %if 0%{?suse_version} >= 1210 %{systemd_requires} From 2c38a55aaadcbdf614b17b8ef9efae29527ad42f Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Tue, 15 Oct 2024 11:37:02 +0200 Subject: [PATCH 3/3] make rubocop happy --- src/clients/inst_microos_role.rb | 1 - src/lib/installation/clients/microos_role_dialog.rb | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/clients/inst_microos_role.rb b/src/clients/inst_microos_role.rb index acd6e2778..29a023d3c 100644 --- a/src/clients/inst_microos_role.rb +++ b/src/clients/inst_microos_role.rb @@ -1,3 +1,2 @@ - require "installation/clients/microos_role_dialog" Installation::MicroOSRoleDialog.new.run diff --git a/src/lib/installation/clients/microos_role_dialog.rb b/src/lib/installation/clients/microos_role_dialog.rb index 6f70b8e8c..476254cf4 100644 --- a/src/lib/installation/clients/microos_role_dialog.rb +++ b/src/lib/installation/clients/microos_role_dialog.rb @@ -1,5 +1,3 @@ -# encoding: utf-8 - # ------------------------------------------------------------------------------ # Copyright (c) 2024 SUSE LLC #