Fix: Adding/Removing multiple services fails

fixes #7616
This commit is contained in:
Gunnar Beutner 2014-11-08 14:57:44 +01:00
parent fd8eed93e0
commit e1287cb7a5
1 changed files with 8 additions and 2 deletions

View File

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