check-routeros-update: support update from specific neighbor(s)

... by matching the identity property.
This commit is contained in:
Christian Hesse 2023-08-17 09:06:44 +02:00
parent 49d85c6def
commit 7b47ed7ea5
5 changed files with 8 additions and 2 deletions

View file

@ -13,6 +13,7 @@
:global Identity;
:global SafeUpdateAll;
:global SafeUpdateNeighbor;
:global SafeUpdateNeighborIdentity;
:global SafeUpdatePatch;
:global SafeUpdateUrl;
:global SentRouterosUpdateNotification;
@ -81,7 +82,8 @@ $LogPrintExit2 debug $0 ("Checking for updates...") false;
}
:if ($SafeUpdateNeighbor = true && [ :len [ /ip/neighbor/find where platform="MikroTik" \
version~("^" . [ $EscapeForRegEx ($Update->"latest-version" . " (" . $Update->"channel" . ")") ]) ] ] > 0) do={
version~("^" . [ $EscapeForRegEx ($Update->"latest-version" . " (" . $Update->"channel" . ")") ]) \
identity~$SafeUpdateNeighborIdentity ] ] > 0) do={
$LogPrintExit2 info $0 ("Seen a neighbor running version " . $Update->"latest-version" . ", updating...") false;
$SendNotification2 ({ origin=$0; \
subject=([ $SymbolForNotification "sparkles" ] . "RouterOS update: " . $Update->"latest-version"); \