1
0
mirror of https://github.com/eworm-de/routeros-scripts.git synced 2024-05-11 05:55:19 +00:00

global-functions: $CertificateAvailable: simplify loop

This commit is contained in:
Christian Hesse
2020-02-02 15:16:36 +01:00
parent 1e72f03e5e
commit 7f81734006

View File

@@ -130,16 +130,16 @@
$CertificateDownload $CommonName;
}
:local CertVal [ / certificate get [ find where common-name=$CommonName ] ];
:local Issuer ([ $ParseKeyValueStore ($CertVal->"issuer") ]->"CN");
:while ($Issuer != $CertVal->"common-name") do={
:local CertVal;
:local Issuer $CommonName;
:do {
:if ([ / certificate print count-only where common-name=$Issuer ] = 0) do={
:log info ("Certificate chain for \"" . $CommonName . "\" is incomplete, missing \"" . $Issuer . "\".");
$CertificateDownload $CommonName;
}
:set CertVal [ / certificate get [ find where common-name=$Issuer ] ];
:set Issuer ([ $ParseKeyValueStore ($CertVal->"issuer") ]->"CN");
}
} while=($Issuer != $CertVal->"common-name");
}
# send notification via e-mail