[icinga-checkins] icinga.org: icinga2/fix/ack-notify-13939: Fix notify/ sticky parameter handling in 'acknowledge-problem' API action

git at icinga.org git at icinga.org
Thu Jan 12 11:46:35 CET 2017


Module: icinga2
Branch: fix/ack-notify-13939
Commit: 81965238d0cfd4e9ab8ef2cb41f8cb27ae2de234
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=81965238d0cfd4e9ab8ef2cb41f8cb27ae2de234

Author: Michael Friedrich <michael.friedrich at icinga.com>
Date:   Thu Jan 12 11:43:22 2017 +0100

Fix notify/sticky parameter handling in 'acknowledge-problem' API action

refs #13939

---

 doc/12-icinga2-api.md     |    6 +++---
 lib/icinga/apiactions.cpp |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/doc/12-icinga2-api.md b/doc/12-icinga2-api.md
index ea1ac5e..e43da2e 100644
--- a/doc/12-icinga2-api.md
+++ b/doc/12-icinga2-api.md
@@ -898,9 +898,9 @@ Send a `POST` request to the URL endpoint `/v1/actions/acknowledge-problem`.
   ----------|-----------|--------------
   author    | string    | **Required.** Name of the author, may be empty.
   comment   | string    | **Required.** Comment text, may be empty.
-  expiry    | timestamp | **Optional.** If set, the acknowledgement will vanish after this timestamp.
-  sticky    | boolean   | **Optional.** If `true`, the default, the acknowledgement will remain until the service or host fully recovers.
-  notify    | boolean   | **Optional.** If `true`, a notification will be sent out to contacts to indicate this problem has been acknowledged. The default is false.
+  expiry    | timestamp | **Optional.** Whether the acknowledgement will be removed at the timestamp.
+  sticky    | boolean   | **Optional.** Whether the acknowledgement will be set until the service or host fully recovers. Defaults to `false`.
+  notify    | boolean   | **Optional.** Whether a notification of the `Acknowledgement` type will be sent. Defaults to `false`.
 
 In addition to these parameters a [filter](12-icinga2-api.md#icinga2-api-filters) must be provided. The valid types for this action are `Host` and `Service`.
 
diff --git a/lib/icinga/apiactions.cpp b/lib/icinga/apiactions.cpp
index c051833..d421135 100644
--- a/lib/icinga/apiactions.cpp
+++ b/lib/icinga/apiactions.cpp
@@ -196,10 +196,10 @@ Dictionary::Ptr ApiActions::AcknowledgeProblem(const ConfigObject::Ptr& object,
 	bool notify = false;
 	double timestamp = 0.0;
 
-	if (params->Contains("sticky"))
+	if (params->Contains("sticky") && HttpUtility::GetLastParameter(params, "sticky"))
 		sticky = AcknowledgementSticky;
 	if (params->Contains("notify"))
-		notify = true;
+		notify = HttpUtility::GetLastParameter(params, "notify");
 	if (params->Contains("expiry"))
 		timestamp = HttpUtility::GetLastParameter(params, "expiry");
 	else



More information about the icinga-checkins mailing list