Skip to content

Commit

Permalink
Merge pull request #9397 from mhashizume/PUP-1881/main/windows-runint…
Browse files Browse the repository at this point in the history
…erval

Correct Windows runinterval behavior
  • Loading branch information
joshcooper authored Jun 18, 2024
2 parents 56d07e9 + 688bf6f commit d9265ab
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ext/windows/service/daemon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,19 @@ def report_windows_event(type, id, message)
end
end

# Parses runinterval.
#
# @param puppet_path [String] The file path for the Puppet executable.
# @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).chomp
if runinterval == ''
runinterval = 1800
log_err("Failed to determine runinterval, defaulting to #{runinterval} seconds")
else
# Use Kernel#Integer because to_i will return 0 with non-numeric strings.
runinterval = Integer(runinterval)
end
rescue Exception => e
log_exception(e)
Expand Down

0 comments on commit d9265ab

Please sign in to comment.