mirror of https://github.com/Icinga/icinga2.git
*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();
|
||||
|
||||
if (groups)
|
||||
if (groups) {
|
||||
groups = groups->ShallowClone();
|
||||
ObjectLock oLock (groups);
|
||||
std::sort(groups->Begin(), groups->End());
|
||||
hashData += DbObject::HashValue(groups);
|
||||
}
|
||||
|
||||
ArrayData parents;
|
||||
|
||||
|
|
|
@ -308,8 +308,12 @@ String ServiceDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields)
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
ArrayData dependencies;
|
||||
|
||||
|
|
|
@ -150,8 +150,12 @@ String UserDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) co
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
return SHA256(hashData);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue