diff options
author | Christian Hesse <mail@eworm.de> | 2022-04-28 09:34:12 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2022-04-28 10:39:25 +0200 |
commit | 4cda1281f1d83208bf6a6c704cbf67b7e7e83b8a (patch) | |
tree | 757baf278cf75e1c0d310a01a8b15dec2032348c | |
parent | 006e054517954b4bf97f11f9d9a5061bf32d3a3e (diff) |
global-functions: validate syntax of modules
(cherry picked from commit 7c8e230521f1a936da034dfc05197fe9434926ed)
-rw-r--r-- | global-functions | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/global-functions b/global-functions index a86c1ea..89234f9 100644 --- a/global-functions +++ b/global-functions @@ -1271,7 +1271,12 @@ # load modules :foreach Script in=[ / system script find where name ~ "^mod/." ] do={ - / system script run $Script; + :local ScriptVal [ / system script get $Script ]; + :if ([ $ValidateSyntax ($ScriptVal->"source") ] = true) do={ + / system script run $Script; + } else={ + $LogPrintExit2 error $0 ("Module '" . $ScriptVal->"name" . "' failed syntax validation, skipping.") false; + } } # check for required RouterOS version |