Class: Y2Network::NtpServer
- Inherits:
-
Object
- Object
- Y2Network::NtpServer
- Includes:
- Yast2::Equatable, Yast::Logger
- Defined in:
- src/lib/y2network/ntp_server.rb
Overview
Represents an NTP server
It includes basic information about NTP servers. It could be extended in the future as needed.
Instance Attribute Summary collapse
-
#country ⇒ String?
readonly
Country code where the server is located.
-
#hostname ⇒ String
readonly
Server's hostname.
-
#location ⇒ String?
readonly
Server's location.
Class Method Summary collapse
-
.default_servers(products = nil) ⇒ Array<NtpServer>
Determines the default servers.
Instance Method Summary collapse
-
#initialize(hostname, country: nil, location: nil) ⇒ NtpServer
constructor
Constructor.
Constructor Details
#initialize(hostname, country: nil, location: nil) ⇒ NtpServer
Constructor
103 104 105 106 107 |
# File 'src/lib/y2network/ntp_server.rb', line 103 def initialize(hostname, country: nil, location: nil) @hostname = hostname @country = country @location = location end |
Instance Attribute Details
#country ⇒ String? (readonly)
Returns Country code where the server is located.
39 40 41 |
# File 'src/lib/y2network/ntp_server.rb', line 39 def country @country end |
#hostname ⇒ String (readonly)
Returns Server's hostname.
37 38 39 |
# File 'src/lib/y2network/ntp_server.rb', line 37 def hostname @hostname end |
#location ⇒ String? (readonly)
Returns Server's location.
41 42 43 |
# File 'src/lib/y2network/ntp_server.rb', line 41 def location @location end |
Class Method Details
.default_servers(products = nil) ⇒ Array<NtpServer>
Determines the default servers
It reads the default NTP servers from the control file, in case of not defined the content of this list will depend on the base product.
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'src/lib/y2network/ntp_server.rb', line 58 def default_servers(products = nil) servers = control_servers if servers log.info "Using the servers defined in the control file: #{servers.inspect}" else servers = product_servers(products) log.info "Using the NTP product servers: #{servers.inspect}" end servers.map { |s| new(s) } end |