Skip to content

Commit 67f657b

Browse files
committed
(PUP-1881) Correct Windows runinterval behavior
Previously when Puppet parsed a runinterval of 0 on Windows, it would set the runinterval to 1800 seconds, Puppet's default runinterval value. This was incorrect behavior, as on other platforms and in the documentation, a runinterval of 0 indicates that Puppet should run continuously. This commit updates the Windows daemon to set the runinterval to 1800 seconds when it receives an empty string and cast to integer in all other cases. (cherry picked from commit 688bf6f)
1 parent 4f0e13c commit 67f657b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ext/windows/service/daemon.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,13 @@ def report_windows_event(type,id,message)
165165
# @return runinterval [Integer] How often to do a Puppet run, in seconds.
166166
def parse_runinterval(puppet_path)
167167
begin
168-
runinterval = %x{ #{puppet_path} config --section agent --log_level notice print runinterval }.to_i
169-
if runinterval == 0
168+
runinterval = %x(#{puppet_path} config --section agent --log_level notice print runinterval).chomp
169+
if runinterval == ''
170170
runinterval = 1800
171171
log_err("Failed to determine runinterval, defaulting to #{runinterval} seconds")
172+
else
173+
# Use Kernel#Integer because to_i will return 0 with non-numeric strings.
174+
runinterval = Integer(runinterval)
172175
end
173176
rescue Exception => e
174177
log_exception(e)

0 commit comments

Comments
 (0)