Merge pull request #8367 from Icinga/bugfix/ido-hash-groups

*DbObject#CalculateConfigHash(): sort groups to be hashed
This commit is contained in:
Alexander Aleksandrovič Klimov 2020-10-14 16:23:24 +02:00 committed by GitHub
commit 79210a5542
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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);
}