From a65a1f21e0d1fdcf09934505544b1813dabd0f34 Mon Sep 17 00:00:00 2001 From: Michael Hashizume Date: Mon, 17 Jun 2024 12:10:38 -0700 Subject: [PATCH] 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. --- ext/windows/service/daemon.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/windows/service/daemon.rb b/ext/windows/service/daemon.rb index 5d8836cab10..d1304f50996 100755 --- a/ext/windows/service/daemon.rb +++ b/ext/windows/service/daemon.rb @@ -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)