From 71976f2eb92c68d8754385b318162d55b9171817 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 27 Apr 2021 20:58:19 +0200 Subject: check-certificates: use $SendNotification2 --- check-certificates | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'check-certificates') diff --git a/check-certificates b/check-certificates index f99b20a..ff93046 100644 --- a/check-certificates +++ b/check-certificates @@ -20,7 +20,7 @@ :global IfThenElse; :global LogPrintExit2; :global ParseKeyValueStore; -:global SendNotification; +:global SendNotification2; :global SymbolForNotification; :global UrlEncode; :global WaitForFile; @@ -95,15 +95,15 @@ $WaitFullyConnected; / certificate set $CertNew name=($CertVal->"name"); } - $SendNotification ([ $SymbolForNotification "lock-with-ink-pen" ] . "Certificate renewed") \ - ("A certificate on " . $Identity . " has been renewed.\n\n" . \ + $SendNotification2 ({ subject=([ $SymbolForNotification "lock-with-ink-pen" ] . "Certificate renewed"); \ + message=("A certificate on " . $Identity . " has been renewed.\n\n" . \ "Name: " . ($CertVal->"name") . "\n" . \ "CommonName: " . ($CertNewVal->"common-name") . "\n" . \ "Private key: " . [ $IfThenElse (($CertNewVal->"private-key") = true) "available" "missing" ] . "\n" . \ "Fingerprint: " . ($CertNewVal->"fingerprint") . "\n" . \ "Issuer: " . ([ $ParseKeyValueStore ($CertNewVal->"issuer") ]->"CN") . "\n" . \ "Validity: " . ($CertNewVal->"invalid-before") . " to " . ($CertNewVal->"invalid-after") . "\n" . \ - "Expires in: " . [ $FormatExpire ($CertNewVal->"expires-after") ]) "" "true"; + "Expires in: " . [ $FormatExpire ($CertNewVal->"expires-after") ]); silent=true }); $LogPrintExit2 info $0 ("The certificate " . ($CertVal->"name") . " has been renewed.") false; } on-error={ $LogPrintExit2 debug $0 ("Could not renew certificate " . ($CertVal->"name") . ".") false; @@ -118,15 +118,15 @@ $WaitFullyConnected; } else={ :local State [ $IfThenElse (($CertVal->"expired") = true) "expired" "is about to expire" ]; - $SendNotification ([ $SymbolForNotification "warning-sign" ] . "Certificate warning!") \ - ("A certificate on " . $Identity . " " . $State . ".\n\n" . \ + $SendNotification2 ({ subject=([ $SymbolForNotification "warning-sign" ] . "Certificate warning!"); \ + message=("A certificate on " . $Identity . " " . $State . ".\n\n" . \ "Name: " . ($CertVal->"name") . "\n" . \ "CommonName: " . ($CertVal->"common-name") . "\n" . \ "Private key: " . [ $IfThenElse (($CertNewVal->"private-key") = true) "available" "missing" ] . "\n" . \ "Fingerprint: " . ($CertVal->"fingerprint") . "\n" . \ "Issuer: " . ($CertVal->"ca") . ([ $ParseKeyValueStore ($CertVal->"issuer") ]->"CN") . "\n" . \ "Validity: " . ($CertVal->"invalid-before") . " to " . ($CertVal->"invalid-after") . "\n" . \ - "Expires in: " . [ $IfThenElse (($CertVal->"expired") = true) "expired" [ $FormatExpire ($CertVal->"expires-after") ] ]); + "Expires in: " . [ $IfThenElse (($CertVal->"expired") = true) "expired" [ $FormatExpire ($CertVal->"expires-after") ] ]) }); $LogPrintExit2 info $0 ("The certificate " . ($CertVal->"name") . " " . $State . \ ", it is invalid after " . ($CertVal->"invalid-after") . ".") false; } -- cgit v1.2.3-70-g09d2 From ebd3dbedcbe5c71dde258a5e05a531ad8c70983f Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 27 Apr 2021 21:58:35 +0200 Subject: check-certificates: pass origin to $SendNotification2 --- check-certificates | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'check-certificates') diff --git a/check-certificates b/check-certificates index ff93046..a052930 100644 --- a/check-certificates +++ b/check-certificates @@ -95,7 +95,8 @@ $WaitFullyConnected; / certificate set $CertNew name=($CertVal->"name"); } - $SendNotification2 ({ subject=([ $SymbolForNotification "lock-with-ink-pen" ] . "Certificate renewed"); \ + $SendNotification2 ({ origin=$0; \ + subject=([ $SymbolForNotification "lock-with-ink-pen" ] . "Certificate renewed"); \ message=("A certificate on " . $Identity . " has been renewed.\n\n" . \ "Name: " . ($CertVal->"name") . "\n" . \ "CommonName: " . ($CertNewVal->"common-name") . "\n" . \ @@ -118,7 +119,8 @@ $WaitFullyConnected; } else={ :local State [ $IfThenElse (($CertVal->"expired") = true) "expired" "is about to expire" ]; - $SendNotification2 ({ subject=([ $SymbolForNotification "warning-sign" ] . "Certificate warning!"); \ + $SendNotification2 ({ origin=$0; \ + subject=([ $SymbolForNotification "warning-sign" ] . "Certificate warning!"); \ message=("A certificate on " . $Identity . " " . $State . ".\n\n" . \ "Name: " . ($CertVal->"name") . "\n" . \ "CommonName: " . ($CertVal->"common-name") . "\n" . \ -- cgit v1.2.3-70-g09d2