Skip to content

Commit

Permalink
Fixed the default synchronization interval in the help text (bsc#978453)
Browse files Browse the repository at this point in the history
- Unify the default value in the code (the proposal client used
  a different default)
- Set the initial state of the interval widget according to
  the current synchronization mode
- Fixed firewall widget layout (double frame widget)
- 3.1.23
  • Loading branch information
lslezak committed May 6, 2016
1 parent b425f65 commit 6405a61
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 20 deletions.
12 changes: 12 additions & 0 deletions package/yast2-ntp-client.changes
@@ -1,3 +1,15 @@
-------------------------------------------------------------------
Fri May 6 16:09:50 UTC 2016 - lslezak@suse.cz

- Fixed the default synchronization interval in the help text
(bsc#978453)
- Unify the default value in the code (the proposal client used
a different default)
- Set the initial state of the interval widget according to
the current synchronization mode
- Fixed firewall widget layout (double frame widget)
- 3.1.23

-------------------------------------------------------------------
Thu Apr 14 09:16:37 CEST 2016 - kanderssen@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-ntp-client.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-ntp-client
Version: 3.1.22
Version: 3.1.23
Release: 0
Summary: YaST2 - NTP Client Configuration
License: GPL-2.0+
Expand Down
6 changes: 2 additions & 4 deletions src/clients/ntp-client_proposal.rb
Expand Up @@ -57,9 +57,7 @@ def main



if false
return
elsif @func == "GetNTPEnabled"
if @func == "GetNTPEnabled"
@ret = GetNTPEnabled()
elsif @func == "SetUseNTP"
NtpClient.ntp_selected = Ops.get_boolean(@param, "ntp_used", false)
Expand Down Expand Up @@ -326,7 +324,7 @@ def WriteNtpSettings(ntp_servers, ntp_server, run_service)
NtpClient.run_service = run_service
if !run_service
NtpClient.synchronize_time = true
NtpClient.sync_interval = 15
NtpClient.sync_interval = NtpClientClass::DEFAULT_SYNC_INTERVAL
end

#OK, so we stored the server address
Expand Down
6 changes: 1 addition & 5 deletions src/include/ntp-client/dialogs.rb
Expand Up @@ -172,11 +172,7 @@ def MainDialog
VSpacing(),
Left("secure"),
VSpacing(),
Frame(
# TRANSLATORS: UI frame label
_("Firewall Settings"),
"firewall"
)
"firewall"
)
),
VStretch()
Expand Down
13 changes: 6 additions & 7 deletions src/include/ntp-client/helps.rb
Expand Up @@ -8,6 +8,7 @@
# $Id$
module Yast
module NtpClientHelpsInclude
Yast.import "NtpClient"
def initialize_ntp_client_helps(include_target)
textdomain "ntp-client"

Expand All @@ -31,16 +32,14 @@ def initialize_ntp_client_helps(include_target)
"Abort the save procedure by pressing <b>Abort</b>.\n" +
"An additional dialog will inform you whether it is safe to do so.</p>"
),
# help text 1/5
# help text 1/5, %d is a number of minutes
"start" => _(
"<p><b><big>Start NTP Daemon</big></b><br>\n" +
"Select whether to start the NTP daemon now and on every system boot. \n" +
"The NTP daemon resolves host names when initializing. Your\n" +
"network connection must be started before the NTP daemon starts.</p>\n" +
"Selecting <b>Synchronize without Daemon</b> the ntp daemon will not be activated. \n" +
"The system time will be set periodically. The interval is configurable. It is 15 minutes by default.\n " +
"You can change this when the system was set up."
),
"Selecting <b>Synchronize without Daemon</b> the ntp daemon will not be activated\n" +
"and the system time will be set periodically by a <i>cron</i> script. \n" +
"The interval is configurable, by default it is %d minutes."
) % NtpClientClass::DEFAULT_SYNC_INTERVAL,
# help text 2/5
"chroot_environment" => _(
"<p><b><big>Chroot Jail</big></b><br>\n" +
Expand Down
3 changes: 3 additions & 0 deletions src/include/ntp-client/widgets.rb
Expand Up @@ -111,6 +111,9 @@ def timeSyncOrNo(id, event)
def intervalInit(id)
UI.ChangeWidget(Id("interval"), :Value, NtpClient.sync_interval)

enabled = UI.QueryWidget(Id("start"), :CurrentButton) == "sync"
UI.ChangeWidget(Id("interval"), :Enabled, enabled)

nil
end

Expand Down
12 changes: 9 additions & 3 deletions src/modules/NtpClient.rb
Expand Up @@ -14,6 +14,12 @@

module Yast
class NtpClientClass < Module

# the default synchronization interval in minutes when running in the manual
# sync mode ("Synchronize without Daemon" option, ntp started from cron)
# Note: the UI field currently uses maximum of 60 minutes
DEFAULT_SYNC_INTERVAL = 5

def main
Yast.import "UI"
textdomain "ntp-client"
Expand Down Expand Up @@ -61,7 +67,7 @@ def main
@synchronize_time = false

# The interval of synchronization in minutes.
@sync_interval = 5
@sync_interval = DEFAULT_SYNC_INTERVAL

# The cron file name for the synchronization.
@cron_file = "/etc/cron.d/novell.ntp-synchronize"
Expand Down Expand Up @@ -462,7 +468,7 @@ def ReadSynchronization
Builtins.y2milestone("CRONTAB %1", crontab)
tmp = Ops.get_string(crontab, [0, "events", 0, "active"], "0")
@synchronize_time = tmp == "1"
tmp = Ops.get_string(crontab, [0, "events", 0, "minute"], "*/5")
tmp = Ops.get_string(crontab, [0, "events", 0, "minute"], "*/#{DEFAULT_SYNC_INTERVAL}")
Builtins.y2milestone("MINUTE %1", tmp)
pos = Builtins.regexppos(tmp, "[0-9]+")
tmp2 = Builtins.substring(
Expand Down Expand Up @@ -930,7 +936,7 @@ def Write
def Import(settings)
settings = deep_copy(settings)
@synchronize_time = Ops.get_boolean(settings, "synchronize_time", false)
@sync_interval = Ops.get_integer(settings, "sync_interval", 5)
@sync_interval = Ops.get_integer(settings, "sync_interval", DEFAULT_SYNC_INTERVAL)
@run_service = Ops.get_boolean(settings, "start_at_boot", false)
@run_chroot = Ops.get_boolean(settings, "start_in_chroot", true)
# compatibility: configure_dhcp:true translates to ntp_policy:auto
Expand Down

0 comments on commit 6405a61

Please sign in to comment.