Skip to content

Commit

Permalink
Force removing obsolete downtimes owned by a ScheduledDowntime
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed May 15, 2024
1 parent 393b6ca commit 81aec89
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/icinga/downtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ void Downtime::RemoveDowntime(const String& id, bool includeChildren, bool cance

if (downtime->IsExpired()) {
reason = "expired at " + Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", downtime->GetEndTime());
} else if (cancelled && !removedBy.IsEmpty()) {
reason = "cancelled by user '" + removedBy + "'";
} else if (cancelled && (!removedBy.IsEmpty() || !config_owner.IsEmpty())) {
reason = "cancelled by " + (!removedBy.IsEmpty() ? "user '" + removedBy : "'" + config_owner) + "'";
} else {
reason = force ? "cancelled forcibly" : "<unknown>";
}
Expand Down
2 changes: 1 addition & 1 deletion lib/icinga/scheduleddowntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ void ScheduledDowntime::RemoveObsoleteDowntimes()
auto configOwnerHash (downtime->GetConfigOwnerHash());

if (!configOwnerHash.IsEmpty() && configOwnerHash != downtimeOptionsHash)
Downtime::RemoveDowntime(downtime->GetName(), false, true);
Downtime::RemoveDowntime(downtime->GetName(), false, true, true);
}
}
}
Expand Down

0 comments on commit 81aec89

Please sign in to comment.