From: Gunnar Beutner Date: Fri, 24 Oct 2014 10:16:14 +0000 (+0200) Subject: Implement support for removing more than one agent X-Git-Tag: v2.2.0~274 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=33b2395ff02de41b4814b1f09cbccb22a6a7332c;p=icinga2 Implement support for removing more than one agent refs #7248 --- 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; }