URI: 
       Correctly report the previous success state - reed-alert - Lightweight agentless alerting system for server
  HTML git clone git://bitreich.org/reed-alert/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/reed-alert/
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR README
   DIR LICENSE
       ---
   DIR commit fd80ed68f6fbb92860af43c7bb0542c5e90022fe
   DIR parent 9698c24926a46f573d376851a397799f4f0fc41d
  HTML Author: Solene Rapenne <solene@perso.pw>
       Date:   Tue,  9 Jul 2019 17:04:17 +0200
       
       Correctly report the previous success state
       
       Diffstat:
         M functions.lisp                      |      16 ++++++++++------
       
       1 file changed, 10 insertions(+), 6 deletions(-)
       ---
   DIR diff --git a/functions.lisp b/functions.lisp
       @@ -121,11 +121,11 @@
                      (delete-file filepath))
        
                    ;; it was a failure and then it's back to normal state
       -            (when triggered-before?
       -              (uiop:run-program (trigger-alert level fonction params t 'success) :output t)
       -              (setf previous-state nil))
       -            ;; in any case we return t because it's ok
       -            t)
       +            (if triggered-before?
       +                (progn
       +                  (uiop:run-program (trigger-alert level fonction params t 'success) :output t)
       +                  (setf previous-state nil))
       +                (setf previous-state t)))
        
                  ;; FAILURE HANDLING
                  (let ((trigger-now? (or
       @@ -152,7 +152,11 @@
                      level fonction (format nil "~{~A ~}" params)
                      (if previous-state "SUCCESS" "ERROR")
                      (if current-state "SUCCESS" "ERROR")
       -              trigger-state (+ 1 tries)))
       +              trigger-state
       +              ;; use tries variable only if previous errors
       +              (if previous-state
       +                  0
       +                  (+ 1 tries))))
            current-state))
        
        ;; abort when using ctrl+c instead of dropping to debugger