| 1949 | } |
| 1950 | |
| 1951 | void ExternalCommandProcessor::ChangeHostEventHandler(double, const std::vector<String>& arguments) |
| 1952 | { |
| 1953 | Host::Ptr host = Host::GetByName(arguments[0]); |
| 1954 | |
| 1955 | if (!host) |
| 1956 | BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot change event handler for non-existent host '" + arguments[0] + "'")); |
| 1957 | |
| 1958 | if (arguments[1].IsEmpty()) { |
| 1959 | Log(LogNotice, "ExternalCommandProcessor") |
| 1960 | << "Unsetting event handler for host '" << arguments[0] << "'"; |
| 1961 | |
| 1962 | host->ModifyAttribute("event_command", ""); |
| 1963 | } else { |
| 1964 | EventCommand::Ptr command = EventCommand::GetByName(arguments[1]); |
| 1965 | |
| 1966 | if (!command) |
| 1967 | BOOST_THROW_EXCEPTION(std::invalid_argument("Event command '" + arguments[1] + "' does not exist.")); |
| 1968 | |
| 1969 | Log(LogNotice, "ExternalCommandProcessor") |
| 1970 | << "Changing event handler for host '" << arguments[0] << "' to '" << arguments[1] << "'"; |
| 1971 | |
| 1972 | host->ModifyAttribute("event_command", command->GetName()); |
| 1973 | } |
| 1974 | } |
| 1975 | |
| 1976 | void ExternalCommandProcessor::ChangeSvcEventHandler(double, const std::vector<String>& arguments) |
| 1977 | { |
nothing calls this directly
no test coverage detected