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

Method AddHostComment

lib/icinga/externalcommandprocessor.cpp:1345–1358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1343}
1344
1345void ExternalCommandProcessor::AddHostComment(double, const std::vector<String>& arguments)
1346{
1347 Host::Ptr host = Host::GetByName(arguments[0]);
1348
1349 if (!host)
1350 BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot add host comment for non-existent host '" + arguments[0] + "'"));
1351
1352 if (arguments[2].IsEmpty() || arguments[3].IsEmpty())
1353 BOOST_THROW_EXCEPTION(std::invalid_argument("Author and comment must not be empty"));
1354
1355 Log(LogNotice, "ExternalCommandProcessor")
1356 << "Creating comment for host " << host->GetName();
1357 (void) Comment::AddComment(host, CommentUser, arguments[2], arguments[3], false, 0);
1358}
1359
1360void ExternalCommandProcessor::DelHostComment(double, const std::vector<String>& arguments)
1361{

Callers

nothing calls this directly

Calls 3

LogClass · 0.85
IsEmptyMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected