Module: Installation::DhcpNtpServers
- Included in:
- MicroOSRoleDialog
- Defined in:
- src/lib/installation/dhcp_ntp_servers.rb
Overview
This module provides a functionality for reading the NTP servers
Instance Method Summary collapse
-
#dhcp_ntp_servers ⇒ Array<String>
List of NTP servers from DHCP.
-
#ntp_fallback ⇒ Array<String>
The fallback servers for NTP configuration.
-
#ntp_servers ⇒ Array<String>
Propose the NTP servers from the DHCP response, fallback to a random machine from the ntp.org pool if enabled in control.xml.
Instance Method Details
#dhcp_ntp_servers ⇒ Array<String>
List of NTP servers from DHCP
30 31 32 33 34 |
# File 'src/lib/installation/dhcp_ntp_servers.rb', line 30 def dhcp_ntp_servers Yast.import "Lan" Yast::Lan.dhcp_ntp_servers end |
#ntp_fallback ⇒ Array<String>
The fallback servers for NTP configuration
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'src/lib/installation/dhcp_ntp_servers.rb', line 56 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 |
#ntp_servers ⇒ Array<String>
Propose the NTP servers from the DHCP response, fallback to a random machine from the ntp.org pool if enabled in control.xml.
42 43 44 45 46 47 48 49 |
# File 'src/lib/installation/dhcp_ntp_servers.rb', line 42 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 |