Skip to content

Commit

Permalink
adapt to chrony journalctl usage
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Nov 3, 2017
1 parent d2781aa commit c57cbe4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
40 changes: 25 additions & 15 deletions src/include/ntp-client/widgets.rb
Expand Up @@ -8,6 +8,9 @@
# $Id$
#
# Main file for ntp-client configuration. Uses all other files.

require "tempfile"

module Yast
module NtpClientWidgetsInclude
include Logger
Expand Down Expand Up @@ -57,22 +60,29 @@ def SilentWrite

# Show popup with NTP daemon's log
def showLogPopup
LogView.Display(
"file" => "/var/log/ntp",
"save" => true,
"actions" => [
# menubutton entry, try to keep short
[
_("Restart NTP Daemon"),
fun_ref(method(:restartNtpDaemon), "void ()")
],
# menubutton entry, try to keep short
[
_("Save Settings and Restart NTP Daemon"),
fun_ref(method(:SilentWrite), "boolean ()")
tmp_file = Tempfile.new("yast_chronylog")
tmp_file.close
begin
SCR.Execute(path(".target.bash"), "/usr/bin/journalctl --boot --unit chronyd --no-pager --no-tail > '#{tmp_file.path}'")
LogView.Display(
"file" => tmp_file.path,
"save" => true,
"actions" => [
# menubutton entry, try to keep short
[
_("Restart NTP Daemon"),
fun_ref(method(:restartNtpDaemon), "void ()")
],
# menubutton entry, try to keep short
[
_("Save Settings and Restart NTP Daemon"),
fun_ref(method(:SilentWrite), "boolean ()")
]
]
]
)
)
ensure
tmp_file.unlink
end
nil
end

Expand Down
7 changes: 1 addition & 6 deletions src/modules/NtpClient.rb
Expand Up @@ -377,12 +377,7 @@ def Read
#
# @return [Array<String>] of servers
def GetUsedNtpServers
used_servers = []
@ntp_records.each do |record|
used_servers << record["address"] if record["type"] == "server"
end

used_servers
ntp_conf.pools.keys
end

# Checks whether all servers listed in the random_pool_servers list
Expand Down

0 comments on commit c57cbe4

Please sign in to comment.