MCPcopy Create free account
hub / github.com/Icinga/icinga2 / AddSvcComment

Method AddSvcComment

lib/icinga/externalcommandprocessor.cpp:1369–1382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1367}
1368
1369void ExternalCommandProcessor::AddSvcComment(double, const std::vector<String>& arguments)
1370{
1371 Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]);
1372
1373 if (!service)
1374 BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot add service comment for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
1375
1376 if (arguments[3].IsEmpty() || arguments[4].IsEmpty())
1377 BOOST_THROW_EXCEPTION(std::invalid_argument("Author and comment must not be empty"));
1378
1379 Log(LogNotice, "ExternalCommandProcessor")
1380 << "Creating comment for service " << service->GetName();
1381 (void) Comment::AddComment(service, CommentUser, arguments[3], arguments[4], false, 0);
1382}
1383
1384void ExternalCommandProcessor::DelSvcComment(double, const std::vector<String>& arguments)
1385{

Callers

nothing calls this directly

Calls 3

LogClass · 0.85
IsEmptyMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected