From 33b2395ff02de41b4814b1f09cbccb22a6a7332c Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 24 Oct 2014 12:16:14 +0200 Subject: [PATCH] Implement support for removing more than one agent refs #7248 --- lib/cli/agentremovecommand.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/cli/agentremovecommand.cpp b/lib/cli/agentremovecommand.cpp index b6014626b..ddc3dc698 100644 --- a/lib/cli/agentremovecommand.cpp +++ b/lib/cli/agentremovecommand.cpp @@ -60,10 +60,17 @@ int AgentRemoveCommand::Run(const boost::program_options::variables_map& vm, con return 1; } - if (!AgentUtility::RemoveAgent(ap[0])) { - Log(LogCritical, "cli", "Cannot remove agent '" + ap[0] + "'."); - return 1; + bool failed = false; + + BOOST_FOREACH(const String& agent, ap) { + if (!AgentUtility::RemoveAgent(agent)) { + Log(LogCritical, "cli", "Cannot remove agent '" + ap[0] + "'."); + failed = true; + } } - return 0; + if (failed) + return 1; + else + return 0; }