Skip to content

Commit

Permalink
recurring downtimes: remove downtime if its empty after removing orph…
Browse files Browse the repository at this point in the history
…aned references
  • Loading branch information
sni committed Mar 27, 2024
1 parent 701faad commit 04bf2fa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/Thruk/Utils/RecurringDowntimes.pm
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,16 @@ sub fix_downtime {

$rd = read_downtime($c, $dfile);
check_downtime($c, $rd, $dfile);

# remove downtime if its empty now
if(( scalar @{Thruk::Base::list($rd->{'host'})}
+ scalar @{Thruk::Base::list($rd->{'service'})}
+ scalar @{Thruk::Base::list($rd->{'hostgroup'})}
+ scalar @{Thruk::Base::list($rd->{'servicegroup'})}
) == 0) {
unlink($dfile);
}

return 1;
}

Expand Down

0 comments on commit 04bf2fa

Please sign in to comment.