aboutsummaryrefslogtreecommitdiffstats
path: root/check-certificates.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-04-06 15:11:28 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-04-07 23:01:32 +0200
commit922dde3ff0ebaab70df8a8bfa402c1d19b624f51 (patch)
tree1d74e83a69af5230a2094e19ba8bd9e4713e9dd0 /check-certificates.rsc
parent46110661e07095b3504cbef5e9a66317146c05ce (diff)
check-certificates: make the function return a status
Diffstat (limited to 'check-certificates.rsc')
-rw-r--r--check-certificates.rsc9
1 files changed, 8 insertions, 1 deletions
diff --git a/check-certificates.rsc b/check-certificates.rsc
index fa0963f..db1127c 100644
--- a/check-certificates.rsc
+++ b/check-certificates.rsc
@@ -34,6 +34,8 @@
:global UrlEncode;
:global WaitForFile;
+ :local Return false;
+
:foreach Type in={ ".pem"; ".p12" } do={
:local CertFileName ([ $UrlEncode $Name ] . $Type);
:do {
@@ -57,10 +59,14 @@
:foreach CertInChain in=[ /certificate/find where name~("^" . $CertFileName . "_[0-9]+\$") common-name!=$Name !(common-name=[]) ] do={
$CertificateNameByCN [ /certificate/get $CertInChain common-name ];
}
+
+ :set Return true;
} on-error={
$LogPrintExit2 debug $0 ("Could not download certificate file " . $CertFileName) false;
}
}
+
+ :return $Return;
}
:local FormatInfo do={
@@ -106,7 +112,8 @@ $WaitFullyConnected;
}
$LogPrintExit2 info $0 ("Attempting to renew certificate " . ($CertVal->"name") . ".") false;
- $CheckCertificatesDownloadImport ($CertVal->"common-name");
+ :local ImportSuccess false;
+ :set ImportSuccess [ $CheckCertificatesDownloadImport ($CertVal->"common-name") ];
:local CertNew [ /certificate/find where common-name=($CertVal->"common-name") fingerprint!=[ :tostr ($CertVal->"fingerprint") ] expires-after>$CertRenewTime ];
:local CertNewVal [ /certificate/get $CertNew ];