Skip to content

Commit

Permalink
16512 FIX Restart scheduler after setting "use the status of a service"
Browse files Browse the repository at this point in the history
The following scenario would break scheduling

 * make host passive with `@service` -> internally sets next check to 0
 * make host active again, for example, `@up`
       -> calls `scheduleHostJob()` with `host->nextCheck()`, which is 0
       -> the invalid timestamp is rejected
       -> scheduling fails and has to be retriggered by the user

SUP-14635

Change-Id: If48579cbd371349263d19b8adcf417b112509f50
  • Loading branch information
Synss committed Jun 14, 2024
1 parent 417882d commit 79969f1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .werks/16512.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[//]: # (werk v2)
# Restart scheduler after setting "use the status of a service"

key | value
---------- | ---
date | 2024-06-13T14:21:01+00:00
version | 2.4.0b1
class | fix
edition | cee
component | core
level | 1
compatible | yes

This fixes the case where the default check scheduler would not restart after
the user temporarily set "use the status of service" as the "host check
command". The corresponding log entry was "refuse to schedule invalid jobhost
... at 1970-0101 ...".
7 changes: 6 additions & 1 deletion packages/cmc/src/Core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,12 @@ void Core::scheduleAllChecks() {

for (const auto &host : _world->config_.hosts_) {
if (host->canBeScheduled()) {
scheduleHostJob({host.get(), host->nextCheck()});
scheduleHostJob(
{host.get(),
// check if host is currently passive
host->nextCheck() == std::chrono::system_clock::time_point{}
? host->nextImmediateCheckTime()
: host->nextCheck()});
}
for (const auto &service : Host::Services(*host)) {
if (service->canBeScheduled()) {
Expand Down

0 comments on commit 79969f1

Please sign in to comment.