From 9a893a735f894e789b784add4fe6fa6b135265c9 Mon Sep 17 00:00:00 2001 From: Simon Meggle Date: Thu, 28 Jul 2022 19:31:46 +0200 Subject: [PATCH] Added missing timeout to V2 bakery script; in V1 and V2, timeout is now 5s less than exec imterval. (closes #203) --- CHANGELOG.md | 8 ++++++++ bakery/v1/robotmk.py | 3 ++- bakery/v2/robotmk.py | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ae2d032..93ab15ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Fixed + +* Bakery (V2): Added missing `timeout` to async robotmk execution. `timeout` is now +set to 5 sec less than the execution interval so that the agent can kill the runner +before the next execution. (#203) + ## 1.2.9 - 2022-03-25 ### Fixed diff --git a/bakery/v1/robotmk.py b/bakery/v1/robotmk.py index b48802f6..b00aac25 100644 --- a/bakery/v1/robotmk.py +++ b/bakery/v1/robotmk.py @@ -61,11 +61,12 @@ def bake_robotmk(opsys, conf, conf_dir, plugins_dir): if opsys == "windows": # async mode in Windows: write configfile in INI-style, will be converted # during installation to YML + timeout = int(config.global_dict['cache_time']) - 5 with Path(conf_dir, "check_mk.ini.plugins.robotmk-runner.py").open("w") as out: out.write(u" execution robotmk-runner.py = async\r\n") out.write(u" cache_age robotmk-runner.py = %d\r\n" % config.global_dict['execution_interval']) # Kill the plugin before the next async execution will start - out.write(u" timeout robotmk-runner.py = %d\r\n" % config.global_dict['cache_time']) + out.write(u" timeout robotmk-runner.py = %d\r\n" % timeout) out.write(u"\r\n") plugins_dir_async = plugins_dir elif opsys == "linux": diff --git a/bakery/v2/robotmk.py b/bakery/v2/robotmk.py index 335637b9..b4711d87 100644 --- a/bakery/v2/robotmk.py +++ b/bakery/v2/robotmk.py @@ -190,7 +190,7 @@ def runner_plugin(self, opsys: OS) -> Plugin: return Plugin( base_os=opsys, source=Path('robotmk-runner.py'), - # TODO: interval=interval, + timeout=self.execution_interval - 5, interval=self.execution_interval, ) else: