From e1287cb7a58bd2b2b0b249bc285a2ffedab413e2 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 8 Nov 2014 14:57:44 +0100 Subject: [PATCH] Fix: Adding/Removing multiple services fails fixes #7616 --- lib/cli/repositoryutility.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/cli/repositoryutility.cpp b/lib/cli/repositoryutility.cpp index 832849f6a..b9c64b91e 100644 --- a/lib/cli/repositoryutility.cpp +++ b/lib/cli/repositoryutility.cpp @@ -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(); GetChangeLog(boost::bind(RepositoryUtility::CollectChange, _1, changelog)); @@ -309,13 +311,17 @@ 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; -- 2.49.0