Skip to content

Commit

Permalink
Changes from review
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Dec 8, 2017
1 parent 5e388c8 commit 0b145f2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
7 changes: 4 additions & 3 deletions src/autoyast-rnc/ntpclient.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ ntp-client =

ntp_policy =
element ntp_policy { text }
# possible values are systemd, manual and number,
# where number is for synchronize in given number of seconds

# Possible values are "systemd", "manual",
# or a positive integer which means the interval in seconds between synchronizations
ntp_sync = element ntp_sync { text }

ntp_servers = element ntp_servers {
LIST,
element ntp_server {
element name {text } &
element address { text } &
element iburst { BOOLEAN }? &
element offline { BOOLEAN }?
}
Expand Down
13 changes: 7 additions & 6 deletions src/modules/NtpClient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ def Import(settings)
Yast::Report.Error(
format(
# TRANSLATORS: error report. %s stands unsuported keys.
_("Old unsupported profile detected. Ntp is not configured. Unsupported keys: '%s'."),
_("Ignoring the NTP configuration. The profile format has changed in an " \
"incompatible way. These keys are no longer supported: '%s'."),
unsupported.join("', '")
)
)
Expand Down Expand Up @@ -404,9 +405,9 @@ def Import(settings)
options = {}
options["iburst"] = nil if server["iburst"]
options["offline"] = nil if server["offline"]
name = server["name"]
log.info "adding server '#{name.inspect}' with options #{options.inspect}"
ntp_conf.add_pool(name, options)
address = server["address"]
log.info "adding server '#{address.inspect}' with options #{options.inspect}"
ntp_conf.add_pool(address, options)
end

true
Expand Down Expand Up @@ -451,9 +452,9 @@ def Export
else
"manual"
end
pools_export = ntp_conf.pools.map do |(name, options)|
pools_export = ntp_conf.pools.map do |(address, options)|
{
"name" => name,
"address" => address,
"iburst" => options.key?("iburst"),
"offline" => options.key?("offline")
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/autoyast/autoinst.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<ntp_servers config:type="list">
<ntp_server>
<iburst config:type="boolean">false</iburst>
<name>cz.pool.ntp.org</name>
<address>cz.pool.ntp.org</address>
<offline config:type="boolean">true</offline>
</ntp_server>
</ntp_servers>
Expand Down
2 changes: 1 addition & 1 deletion test/y2ntp_client/client/auto_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

describe "#import" do
it "pass its arguments to NtpClient.Import" do
arguments = {"ntp_policy" => "auto"}
arguments = { "ntp_policy" => "auto" }
expect(Yast::NtpClient).to receive(:Import).with(arguments)
subject.import(arguments)
end
Expand Down

0 comments on commit 0b145f2

Please sign in to comment.