Skip to content

Commit

Permalink
Correct Windows runinterval behavior
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mhashizume committed Jun 17, 2024
1 parent 2fafe0b commit a65a1f2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ext/windows/service/daemon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,12 @@ def report_windows_event(type, id, message)
# @return runinterval [Integer] How often to do a Puppet run, in seconds.
def parse_runinterval(puppet_path)
begin
runinterval = %x(#{puppet_path} config --section agent --log_level notice print runinterval).to_i
if runinterval == 0
runinterval = %x(#{puppet_path} config --section agent --log_level notice print runinterval)
if runinterval == ''
runinterval = 1800
log_err("Failed to determine runinterval, defaulting to #{runinterval} seconds")
else
runinterval = runinterval.to_i
end
rescue Exception => e
log_exception(e)
Expand Down

0 comments on commit a65a1f2

Please sign in to comment.