103 Commits

Author SHA1 Message Date
Julian Brost
e1d4fcd8d1 Merge remote-tracking branch 'origin/feature/v1-actions-execute-command-8034-2.11.7' into jbrost/2.11.9-with-execute-command-and-connect-timeout 2021-06-28 17:42:17 +02:00
Julian Brost
77427bedae AddDowntime: return Downtime::Ptr instead of String containing the name
At numerous places in the code, something like this is performed:

    String name = Downtime::AddDowntime(...);
    Downtime::Ptr downtime = Downtime::GetByName(name);

However, `downtime` can be a `nullptr` after this as it is possible that
the downtime is deleted in between.

This commit changes the return type of `Downtime::AddDowntime` to return
a Downtime::Ptr instead of the full name of the downtime. `AddDowntime`
performs the very same `GetByName()` operation internally, but handles
the `nullptr` case correctly and throws an exception.
2021-05-26 08:54:01 +02:00
Alexander A. Klimov
eb454b8517 Introduce Endpoint#capabilities
refs #8034
2020-11-20 17:41:45 +01:00
Mattia Codato
e4c9616068 Set exit code 126 if endpoint doens't support the new executeCommand API 2020-11-20 17:38:27 +01:00
Mattia Codato
f1f5bb4738 Check child endpoint versions and check child zone can access to the target endpoint 2020-11-20 17:38:27 +01:00
Mattia Codato
85e2f3a479 Check satellites Icinga version before relay the execute command message 2020-11-20 17:38:27 +01:00
Mattia Codato
1253aa07e4 Change checkable with the endpoint zone for execute command relay message 2020-11-20 17:38:27 +01:00
Mattia Codato
5134eca2ab Forward the execute command through the zones 2020-11-20 17:38:27 +01:00
Mattia Codato
3a105cfe7c Use ExecuteOverride to override the command 2020-11-20 17:38:27 +01:00
Mattia Codato
bb2726a44e Fix macros substitutions 2020-11-20 17:38:27 +01:00
Mattia Codato
f790b7699d Check if last check result is null before executing the command 2020-11-20 17:38:27 +01:00
Mattia Codato
0251df22d5 Implement notification execution 2020-11-20 17:38:27 +01:00
Mattia Codato
e538272b1c Change check_command and event_command strings to CheckCommand and EventCommand 2020-11-20 17:38:26 +01:00
Mattia Codato
ab70b39b56 Change command type 'notification_command' with 'NotificationCommand' 2020-11-20 17:38:26 +01:00
Mattia Codato
dc21536196 Uniform command_type strings 2020-11-20 17:38:26 +01:00
Mattia Codato
7627e3306f Refactor GetSingleObjectByNameUsingPermissions 2020-11-20 17:38:26 +01:00
Mattia Codato
09ac9c3764 Add GetSingleObjectByNameUsingPermissions function 2020-11-20 17:38:26 +01:00
Mattia Codato
d29c5bfe39 Change result 2020-11-20 17:38:26 +01:00
Mattia Codato
820d053363 Refactor MacroResolver::OverrideMacros 2020-11-20 17:38:26 +01:00
Mattia Codato
a64d902866 Add overrideMacros property to MacroResolver 2020-11-20 17:38:26 +01:00
Mattia Codato
edd32b4e26 AuthenticatedApiUser name refactor 2020-11-20 17:38:26 +01:00
Mattia Codato
ef3ed6b826 Make authenticatedApiUser a static property of ActionsHandler 2020-11-20 17:38:26 +01:00
Mattia Codato
cb8a083e11 Get API user from ActionsHandler 2020-11-20 17:38:26 +01:00
Mattia Codato
3b7bb0d9cc Get last CheckResult 2020-11-20 17:38:26 +01:00
Mattia Codato
469d553f15 Fix indentation 2020-11-20 17:38:26 +01:00
Mattia Codato
6eed0838f1 Call notificationCommand->Execute 2020-11-20 17:38:26 +01:00
Mattia Codato
97ef265e88 Update execMacros 2020-11-20 17:38:26 +01:00
Mattia Codato
cc0529d578 Move some checks. Add macros parameters to ExecuteCommand message 2020-11-20 17:38:26 +01:00
Mattia Codato
d8f48e459a Update status code 2020-11-20 17:38:26 +01:00
Mattia Codato
f0fe777eb0 Use RelayMessage to broadcast the updated executions 2020-11-20 17:38:26 +01:00
Mattia Codato
e36644c7d9 Remove unnecessary check 2020-11-20 17:38:26 +01:00
Mattia Codato
a7a5b94a6f Use HttpUtility::GetLastParameter to get endpoint 2020-11-20 17:38:26 +01:00
Mattia Codato
cf2168d7d0 Fix response strings 2020-11-20 17:38:26 +01:00
Mattia Codato
d58cbf233b Use dynamic_pointer_cast 2020-11-20 17:38:26 +01:00
Mattia Codato
20dab6669b Unify how to take macros parameter 2020-11-20 17:38:26 +01:00
Mattia Codato
291a9c7bd2 Use SyncSendMessage for remote endpoint and call ExecuteCommandAPIHandler for local endpoint 2020-11-20 17:38:26 +01:00
Mattia Codato
895b587db0 Use the right method to get the notification command 2020-11-20 17:38:26 +01:00
Mattia Codato
932b7162a4 Use RelayMessage instead of SyncSendMessage 2020-11-20 17:38:26 +01:00
Mattia Codato
8444cccd37 Call Endpoint::GetByName only once 2020-11-20 17:38:26 +01:00
Mattia Codato
c1f3356754 Add newline at the end of file 2020-11-20 17:38:26 +01:00
Mattia Codato
fd071f9512 Unify result status strings 2020-11-20 17:38:26 +01:00
Mattia Codato
a8256ab422 Code format 2020-11-20 17:38:26 +01:00
Mattia Codato
bce57821de Fix resolve macros. Check if endpoint is local or remote 2020-11-20 17:38:26 +01:00
Mattia Codato
5442092218 Remove wait parameter, ttl is required, remove unnecessary checks 2020-11-20 17:38:26 +01:00
Benjamin Groeber
b3a504bc9c Use tabs instead of spaces 2020-11-20 17:38:26 +01:00
Benjamin Groeber
7544f7c3f3 Fix formatting of long fn 2020-11-20 17:38:26 +01:00
Benjamin Groeber
a11f3d0101 Remove superfluous else clause 2020-11-20 17:38:26 +01:00
Andrea Avancini
317b20c48e Parameter evaluation, macro resolution, update executions, send ExecuteCommand message for ExecuteCommand Endpoint 2020-11-20 17:38:26 +01:00
Alexander A. Klimov
f5b9905161 Add stub for /v1/actions/execute-command
refs #8034
2020-11-20 17:38:25 +01:00
Michael Friedrich
f58d1ef7f7 Revert "API: Improve error handling for 'schedule-downtime' action"
This reverts commit 8ca38302fceeb05f99c703e1e66b234de996cbd5.
2019-08-01 14:03:44 +02:00