Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PUP-1881) Correct Windows runinterval behavior #9397

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 == ''
mhashizume marked this conversation as resolved.
Show resolved Hide resolved
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
Loading