Skip to content

Commit

Permalink
Removed dynamic servers once the method was moved to Yast::Lan
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Nov 13, 2018
1 parent 90bd489 commit e3bfea4
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 74 deletions.
5 changes: 3 additions & 2 deletions src/clients/ntp-client_proposal.rb
Expand Up @@ -13,6 +13,7 @@ def main
textdomain "ntp-client"

Yast.import "Address"
Yast.import "Lan"
Yast.import "NetworkService"
Yast.import "NtpClient"
Yast.import "Service"
Expand Down Expand Up @@ -62,7 +63,7 @@ def main
NtpClient.ntp_selected = Ops.get_boolean(@param, "ntp_used", false)
@ret = true
when "dhcp_ntp_servers"
@ret = NtpClient.dhcp_ntp_servers
@ret = Yast::Lan.dhcp_ntp_servers
when "MakeProposal"
@ret = MakeProposal()
when "Write"
Expand Down Expand Up @@ -506,7 +507,7 @@ def fallback_ntp_items
dhcp_items = dhcp_ntp_items

log.info("Nothing found in /etc/chrony.conf")
unless dhcp_items.empty?
if dhcp_items.empty?
log.info("Proposing current timezone-based NTP server list")
return timezone_ntp_items
end
Expand Down
4 changes: 4 additions & 0 deletions src/lib/y2ntp_client/dialog/add_pool.rb
Expand Up @@ -82,6 +82,10 @@ def pool_for(type)
def min_height
8
end

def buttons
[ok_button, cancel_button]
end
end
end
end
22 changes: 0 additions & 22 deletions src/lib/y2ntp_client/dynamic_servers.rb

This file was deleted.

19 changes: 11 additions & 8 deletions src/lib/y2ntp_client/widgets/pool_widgets.rb
Expand Up @@ -2,12 +2,11 @@

require "cwm/widget"
require "y2ntp_client/dialog/add_pool"
require "y2ntp_client/dynamic_servers"

Yast.import "Address"
Yast.import "NtpClient"
Yast.import "Popup"
Yast.import "NetworkService"
Yast.import "Lan"

module Y2NtpClient
module Widgets
Expand Down Expand Up @@ -172,25 +171,29 @@ def cwm_definition

super.merge(additional)
end

def help
_("<p><b>Select</b> permits to choose a server from the list of servers" \
"offered by DHCP or from a public list filtered by country.</p>") \
end
end

# List of ntp servers obtained from DHCP
class LocalList < CWM::SelectionBox
include DynamicServers
# Constructor
#
# @param address [String] current ntp pool address
def initialize(address)
textdomain "ntp-client"
@address = address

Yast::Popup.Feedback(_("Getting ntp sources from DHCP"), Yast::Message.takes_a_while) do
@servers = ntp_servers
end
@servers = []
end

# @macro seeAbstractWidget
def init
Yast::Popup.Feedback(_("Getting ntp sources from DHCP"), Yast::Message.takes_a_while) do
@servers = ntp_servers
end
self.value = @address
end

Expand Down Expand Up @@ -222,7 +225,7 @@ def help
#
# @return [Array<String>] list of ntp servers provided by dhcp
def ntp_servers
dhcp_ntp_servers.reject { |s| Yast::NtpClient.ntp_conf.pools.keys.include?(s) }
Yast::Lan.dhcp_ntp_servers.reject { |s| Yast::NtpClient.ntp_conf.pools.keys.include?(s) }
end
end

Expand Down
2 changes: 0 additions & 2 deletions src/modules/NtpClient.rb
Expand Up @@ -12,15 +12,13 @@
require "yast"
require "yaml"
require "cfa/chrony_conf"
require "y2ntp_client/dynamic_servers"
require "yast2/target_file" # required to cfa work on changed scr
require "ui/text_helpers"

module Yast
class NtpClientClass < Module
include Logger
include ::UI::TextHelpers
include ::Y2NtpClient::DynamicServers

# the default synchronization interval in minutes when running in the manual
# sync mode ("Synchronize without Daemon" option, ntp started from cron)
Expand Down
39 changes: 0 additions & 39 deletions test/y2ntp_client/dynamic_servers_test.rb

This file was deleted.

8 changes: 7 additions & 1 deletion test/y2ntp_client/widgets/pool_widgets_test.rb
Expand Up @@ -22,7 +22,7 @@
include_examples "CWM::CheckBox"
end

describe Y2NtpClient::Widgets::Iburst do
describe Y2NtpClient::Widgets::Offline do
subject { described_class.new({}) }

include_examples "CWM::CheckBox"
Expand All @@ -39,3 +39,9 @@

include_examples "CWM::CustomWidget"
end

describe Y2NtpClient::Widgets::SelectFrom do
subject { described_class.new({}) }

include_examples "CWM::AbstractWidget"
end

0 comments on commit e3bfea4

Please sign in to comment.