From 5dab744b814209468ee352e64d1777e83014c28c Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 16 Oct 2019 14:47:33 +0200 Subject: [PATCH] Health: do not complain about new jobs... ...that have never been triggered and are not due right now fixes #1994 --- doc/82-Changelog.md | 3 +++ library/Director/Health.php | 2 +- library/Director/Objects/DirectorJob.php | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/82-Changelog.md b/doc/82-Changelog.md index 11dc288d..de4bb776 100644 --- a/doc/82-Changelog.md +++ b/doc/82-Changelog.md @@ -32,6 +32,9 @@ next (will be 1.8.0) ### Import and Sync * FIX: Upper- and Lowercase property modifiers are now multibyte/UTF8-safe (#710) +### Health Check +* FIX: do not complain about no-due newly created jobs (#1994) + ### Background Daemon * FIX: Daemon didn't report DB state to systemd (#1983) diff --git a/library/Director/Health.php b/library/Director/Health.php index cd332ca3..0d85d18a 100644 --- a/library/Director/Health.php +++ b/library/Director/Health.php @@ -212,7 +212,7 @@ class Health $name = $job->get('job_name'); if ($job->hasBeenDisabled()) { $check->succeed("'$name' has been disabled"); - } elseif (! $job->lastAttemptSucceeded()) { + } elseif ($job->lastAttemptFailed()) { $message = $job->get('last_error_message'); $check->fail("Last attempt for '$name' failed: $message"); } elseif ($job->isOverdue()) { diff --git a/library/Director/Objects/DirectorJob.php b/library/Director/Objects/DirectorJob.php index 4746d85b..0a0555bb 100644 --- a/library/Director/Objects/DirectorJob.php +++ b/library/Director/Objects/DirectorJob.php @@ -156,6 +156,11 @@ class DirectorJob extends DbObjectWithSettings implements ExportInterface return $this->get('last_attempt_succeeded') === 'y'; } + public function lastAttemptFailed() + { + return $this->get('last_attempt_succeeded') === 'n'; + } + public function hasTimeperiod() { return $this->get('timeperiod_id') !== null;