On ScheduledDowntime change: remove downtimes created before change

... to cause their re-creation with the ScheduledDowntime change
taken into account.

refs #8309
This commit is contained in:
Alexander A. Klimov 2020-12-14 15:47:02 +01:00
parent a93f269cab
commit 7874ed6436

View File

@ -197,8 +197,33 @@ bool Downtime::HasValidConfigOwner() const
return true;
}
String configOwner = GetConfigOwner();
return configOwner.IsEmpty() || Zone::GetByName(GetAuthoritativeZone()) != Zone::GetLocalZone() || GetObject<ScheduledDowntime>(configOwner);
if (Zone::GetByName(GetAuthoritativeZone()) != Zone::GetLocalZone()) {
return true;
}
ScheduledDowntime::Ptr owner;
{
auto configOwner (GetConfigOwner());
if (configOwner.IsEmpty()) {
return true;
}
owner = GetObject<ScheduledDowntime>(configOwner);
if (!owner) {
return false;
}
}
auto configOwnerHash (GetConfigOwnerHash());
if (configOwnerHash.IsEmpty()) {
return true;
}
return configOwnerHash == owner->HashDowntimeOptions();
}
int Downtime::GetNextDowntimeID()