Skip to content

Commit

Permalink
implemented skeleton of ntp servers parsing. fate#323454
Browse files Browse the repository at this point in the history
  • Loading branch information
mchf committed Oct 30, 2018
1 parent eb07e89 commit d60132b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib/network/wicked.rb
Expand Up @@ -16,5 +16,16 @@ def reload_config(devs)

SCR.Execute(BASH_PATH, "wicked ifreload #{devs.join(" ")}").zero?
end

# Parses wicked runtime configuration and returns list of ntp servers
#
# @param iface [String] network device
# @return [Array<String>] list of NTP servers
def parse_ntp_servers(iface)
raise ArgumentError, "A network device has to be specified" if iface.nil? || iface.empty?
raise RuntimeError, "Parsing NTP Servers not supported for network service in use" if !NetworkService.is_wicked

[]
end
end
end
13 changes: 13 additions & 0 deletions src/modules/LanItems.rb
Expand Up @@ -2540,6 +2540,19 @@ def clear_set_hostname
ret
end

# Returns hash of NTP servers
#
# Provides map with NTP servers obtained via any of dhcp aware interfaces
#
# @return [Hash<String, Array<String>] key is device name, value
# is list of ntp servers obtained from the device
def dhcp_ntp_servers
dhcp_ifaces = find_dhcp_ifaces

result = dhcp_ifaces.map { |iface| [iface, parse_ntp_servers(iface)] }.to_h
result.delete_if { |iface, ntps| ntps.empty? }
end

# This helper allows YARD to extract DSL-defined attributes.
# Unfortunately YARD has problems with the Capitalized ones,
# so those must be done manually.
Expand Down

0 comments on commit d60132b

Please sign in to comment.