[pve-devel] [PATCH manager] schedule-analyze: fix schedules with limited runs

Dominik Csapak d.csapak at proxmox.com
Tue May 3 16:10:25 CEST 2022


When a schedule only has a limited amount of runs it can happen
(e.g. 2022-10-01 8:00/30), $next will be undef after the last run.
Exit early in that case.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Cluster/Jobs.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/PVE/API2/Cluster/Jobs.pm b/PVE/API2/Cluster/Jobs.pm
index 2699442a..8166333d 100644
--- a/PVE/API2/Cluster/Jobs.pm
+++ b/PVE/API2/Cluster/Jobs.pm
@@ -97,6 +97,7 @@ __PACKAGE__->register_method({
 
 	for (my $count = 0; $count < $iterations; $count++) {
 	    my $next = PVE::CalendarEvent::compute_next_event($event, $starttime);
+	    last if !defined($next);
 	    push @$result, {
 		timestamp => $next,
 		utc => scalar(gmtime($next)),
-- 
2.30.2






More information about the pve-devel mailing list