mirror of https://github.com/Icinga/icinga2.git
parent
fd8eed93e0
commit
e1287cb7a5
|
@ -297,6 +297,8 @@ bool RepositoryUtility::SetObjectAttribute(const String& name, const String& typ
|
|||
|
||||
bool RepositoryUtility::CheckChangeExists(const Dictionary::Ptr& change)
|
||||
{
|
||||
Dictionary::Ptr attrs = change->Get("attrs");
|
||||
|
||||
Array::Ptr changelog = make_shared<Array>();
|
||||
|
||||
GetChangeLog(boost::bind(RepositoryUtility::CollectChange, _1, changelog));
|
||||
|
@ -309,14 +311,18 @@ bool RepositoryUtility::CheckChangeExists(const Dictionary::Ptr& change)
|
|||
if (entry->Get("name") != change->Get("name"))
|
||||
continue;
|
||||
|
||||
Dictionary::Ptr their_attrs = entry->Get("attrs");
|
||||
|
||||
if (entry->Get("type") == "Service" && attrs->Get("host_name") != their_attrs->Get("host_name"))
|
||||
continue;
|
||||
|
||||
if (entry->Get("command") != change->Get("command"))
|
||||
continue;
|
||||
|
||||
/* only works for add/remove commands (no set) */
|
||||
if (change->Get("command") == "add" || change->Get("command") == "remove") {
|
||||
if (change->Get("command") == "add" || change->Get("command") == "remove")
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue