]> granicus.if.org Git - icinga2/commitdiff
Fix notify/sticky parameter handling in 'acknowledge-problem' API action 5026/head
authorMichael Friedrich <michael.friedrich@icinga.com>
Thu, 12 Jan 2017 10:43:22 +0000 (11:43 +0100)
committerMichael Friedrich <michael.friedrich@icinga.com>
Thu, 23 Feb 2017 11:30:28 +0000 (12:30 +0100)
refs #13939

doc/12-icinga2-api.md
lib/icinga/apiactions.cpp

index db10da0f1d82e08c4c4f88c92964ec96d348e62d..ffc7df04faf5d51e4dcb90c0557f96ad279e362c 100644 (file)
@@ -905,9 +905,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`.
 
index c05183355cec7276da301b74188b70aca5eeca04..d4211357b507db8bda2e47e69914f1a2ed0a00a5 100644 (file)
@@ -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