From 1eb8b7168880235a9e39531ac1de5a4e21cdd3f1 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Wed, 7 Mar 2018 10:40:03 +0100 Subject: [PATCH 1/8] use new name --- src/modules/NtpClient.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/modules/NtpClient.rb b/src/modules/NtpClient.rb index 19f1ee10..d36fe43a 100644 --- a/src/modules/NtpClient.rb +++ b/src/modules/NtpClient.rb @@ -35,6 +35,9 @@ class NtpClientClass < Module NTP_FILE = "/etc/chrony.conf".freeze + # The cron file name for the synchronization. + CRON_FILE = "/etc/cron.d/suse-ntp_synchronize" + UNSUPPORTED_AUTOYAST_OPTIONS = [ "configure_dhcp", "peers", @@ -85,8 +88,6 @@ def main # The interval of synchronization in minutes. @sync_interval = DEFAULT_SYNC_INTERVAL - # The cron file name for the synchronization. - @cron_file = "/etc/cron.d/novell.ntp-synchronize" # Service name of the NTP daemon @service_name = "chronyd" @@ -272,7 +273,7 @@ def ProcessNtpConf # synchronize_time and sync_interval variables # Return updated value of synchronize_time def ReadSynchronization - crontab = SCR.Read(path(".cron"), @cron_file, "") + crontab = SCR.Read(path(".cron"), CRON_FILE, "") log.info("NTP Synchronization crontab entry: #{crontab}") cron_entry = (crontab || []).fetch(0, {}).fetch("events", []).fetch(0, {}) @synchronize_time = cron_entry["active"] == "1" @@ -812,13 +813,13 @@ def update_cron_settings if @synchronize_time SCR.Write( path(".target.string"), - @cron_file, + CRON_FILE, "-*/#{@sync_interval} * * * * root /usr/sbin/chronyd -q &>/dev/null\n" ) else SCR.Execute( path(".target.bash"), - "test -e #{@cron_file} && rm #{@cron_file};" + "test -e #{CRON_FILE} && rm #{CRON_FILE};" ) end end From 20eee1db61ed7a2169750dff585965fa14c8d433 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Wed, 7 Mar 2018 10:52:57 +0100 Subject: [PATCH 2/8] handle upgrade and add ghost file --- package/yast2-ntp-client.spec | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/package/yast2-ntp-client.spec b/package/yast2-ntp-client.spec index 0d2c5f5a..a7459dcb 100644 --- a/package/yast2-ntp-client.spec +++ b/package/yast2-ntp-client.spec @@ -61,6 +61,13 @@ rake test:unit %install rake install DESTDIR="%{buildroot}" +%post +# upgrade old name and convert it to chrony (bsc#1079122) +if [ -f /etc/cron.d/novell.ntp-synchronize ]; then + mv /etc/cron.d/novell.ntp-synchronize /etc/cron.d/suse-ntp_synchronize + sed -i 's:\* \* \* \* root .*:* * * * root /usr/sbin/chronyd -q \&>/dev/null:' /etc/cron.d/suse-ntp_synchronize +fi + %files %defattr(-,root,root) %dir %{yast_yncludedir}/ntp-client @@ -72,6 +79,7 @@ rake install DESTDIR="%{buildroot}" %{yast_ydatadir}/ntp_servers.yml %{yast_schemadir}/autoyast/rnc/ntpclient.rnc %{yast_dir}/lib +%ghost /etc/cron.d/suse-ntp_synchronize %dir %{yast_docdir} %doc %{yast_docdir}/COPYING From a01d09c43a4331025b75d7472023491e24298507 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Wed, 7 Mar 2018 10:57:25 +0100 Subject: [PATCH 3/8] changes from review --- src/modules/NtpClient.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/NtpClient.rb b/src/modules/NtpClient.rb index d36fe43a..87aa588b 100644 --- a/src/modules/NtpClient.rb +++ b/src/modules/NtpClient.rb @@ -36,7 +36,7 @@ class NtpClientClass < Module NTP_FILE = "/etc/chrony.conf".freeze # The cron file name for the synchronization. - CRON_FILE = "/etc/cron.d/suse-ntp_synchronize" + CRON_FILE = "/etc/cron.d/suse-ntp_synchronize".freeze UNSUPPORTED_AUTOYAST_OPTIONS = [ "configure_dhcp", From e2ba26ba4911f7735ee92168ea55c616e226d64f Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Wed, 7 Mar 2018 10:59:52 +0100 Subject: [PATCH 4/8] fix tests --- test/ntp_client_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ntp_client_test.rb b/test/ntp_client_test.rb index 8e585b80..442581f9 100644 --- a/test/ntp_client_test.rb +++ b/test/ntp_client_test.rb @@ -388,7 +388,7 @@ end describe "#ReadSynchronization" do - let(:cron_job_file) { "/etc/cron.d/novell.ntp-synchronize" } + let(:cron_job_file) { "/etc/cron.d/suse-ntp_synchronize" } let(:cron_entry) { [] } before do From 8facdb8932447a11d7d657be5e6bf3c7ca654ca7 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Wed, 7 Mar 2018 11:57:33 +0100 Subject: [PATCH 5/8] make rubocop happy --- src/modules/NtpClient.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/src/modules/NtpClient.rb b/src/modules/NtpClient.rb index 87aa588b..2ad702c8 100644 --- a/src/modules/NtpClient.rb +++ b/src/modules/NtpClient.rb @@ -88,7 +88,6 @@ def main # The interval of synchronization in minutes. @sync_interval = DEFAULT_SYNC_INTERVAL - # Service name of the NTP daemon @service_name = "chronyd" From ee5ca9e18f051ce69939efb100cb23734bf3d4a0 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Wed, 7 Mar 2018 11:59:26 +0100 Subject: [PATCH 6/8] changes --- package/yast2-ntp-client.changes | 10 ++++++++++ package/yast2-ntp-client.spec | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/package/yast2-ntp-client.changes b/package/yast2-ntp-client.changes index 803ca93b..fd102013 100644 --- a/package/yast2-ntp-client.changes +++ b/package/yast2-ntp-client.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Mar 7 10:57:36 UTC 2018 - jreidinger@suse.com + +- change cron config file name to suse-ntp_synchronize + (bsc#1079122) +- convert old file to new one during upgrade, ensure that ntpd is + replaced by chrony (FATE#323432) +- ghost that config file, so it is easy to find who own it +- 4.0.9 + ------------------------------------------------------------------- Thu Feb 22 15:21:04 UTC 2018 - gsouza@suse.com diff --git a/package/yast2-ntp-client.spec b/package/yast2-ntp-client.spec index a7459dcb..26e9e8ca 100644 --- a/package/yast2-ntp-client.spec +++ b/package/yast2-ntp-client.spec @@ -17,7 +17,7 @@ Name: yast2-ntp-client -Version: 4.0.8 +Version: 4.0.9 Release: 0 Summary: YaST2 - NTP Client Configuration License: GPL-2.0+ From 0d9c4b6a3aaebc950e3d0f8938c6db42ed09d788 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Wed, 7 Mar 2018 12:03:42 +0100 Subject: [PATCH 7/8] fix from review --- package/yast2-ntp-client.changes | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package/yast2-ntp-client.changes b/package/yast2-ntp-client.changes index fd102013..f5e61b49 100644 --- a/package/yast2-ntp-client.changes +++ b/package/yast2-ntp-client.changes @@ -3,9 +3,10 @@ Wed Mar 7 10:57:36 UTC 2018 - jreidinger@suse.com - change cron config file name to suse-ntp_synchronize (bsc#1079122) -- convert old file to new one during upgrade, ensure that ntpd is +- convert old file to new one during upgrade, ensure that ntpd is replaced by chrony (FATE#323432) -- ghost that config file, so it is easy to find who own it +- ghost that config file, so it is easy to find which package owns + it - 4.0.9 ------------------------------------------------------------------- From b0b7c2356de34207cd0232caca714057d46599b2 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Wed, 7 Mar 2018 12:12:43 +0100 Subject: [PATCH 8/8] changes from review --- src/modules/NtpClient.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/NtpClient.rb b/src/modules/NtpClient.rb index 2ad702c8..8d764b82 100644 --- a/src/modules/NtpClient.rb +++ b/src/modules/NtpClient.rb @@ -818,7 +818,7 @@ def update_cron_settings else SCR.Execute( path(".target.bash"), - "test -e #{CRON_FILE} && rm #{CRON_FILE};" + "rm -vf #{CRON_FILE}" ) end end