mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 05:34:48 +02:00
*DbObject#CalculateConfigHash(): sort groups to be hashed
... to ensure consistent hashes across config reloads. This will likely cause a heavy update once for all objects in >1 group, but it will ensure that this happens the last time.
This commit is contained in:
parent
e9b8fc234b
commit
cb00a7fd6a
@ -356,8 +356,12 @@ String HostDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) co
|
|||||||
|
|
||||||
Array::Ptr groups = host->GetGroups();
|
Array::Ptr groups = host->GetGroups();
|
||||||
|
|
||||||
if (groups)
|
if (groups) {
|
||||||
|
groups = groups->ShallowClone();
|
||||||
|
ObjectLock oLock (groups);
|
||||||
|
std::sort(groups->Begin(), groups->End());
|
||||||
hashData += DbObject::HashValue(groups);
|
hashData += DbObject::HashValue(groups);
|
||||||
|
}
|
||||||
|
|
||||||
ArrayData parents;
|
ArrayData parents;
|
||||||
|
|
||||||
|
@ -308,8 +308,12 @@ String ServiceDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields)
|
|||||||
|
|
||||||
Array::Ptr groups = service->GetGroups();
|
Array::Ptr groups = service->GetGroups();
|
||||||
|
|
||||||
if (groups)
|
if (groups) {
|
||||||
|
groups = groups->ShallowClone();
|
||||||
|
ObjectLock oLock (groups);
|
||||||
|
std::sort(groups->Begin(), groups->End());
|
||||||
hashData += DbObject::HashValue(groups);
|
hashData += DbObject::HashValue(groups);
|
||||||
|
}
|
||||||
|
|
||||||
ArrayData dependencies;
|
ArrayData dependencies;
|
||||||
|
|
||||||
|
@ -150,8 +150,12 @@ String UserDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) co
|
|||||||
|
|
||||||
Array::Ptr groups = user->GetGroups();
|
Array::Ptr groups = user->GetGroups();
|
||||||
|
|
||||||
if (groups)
|
if (groups) {
|
||||||
|
groups = groups->ShallowClone();
|
||||||
|
ObjectLock oLock (groups);
|
||||||
|
std::sort(groups->Begin(), groups->End());
|
||||||
hashData += DbObject::HashValue(groups);
|
hashData += DbObject::HashValue(groups);
|
||||||
|
}
|
||||||
|
|
||||||
return SHA256(hashData);
|
return SHA256(hashData);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user