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:19:07 +0200 |
commit | 7c8e230521f1a936da034dfc05197fe9434926ed (patch) | |
tree | e650eb89ea406c792d42328d96210a33e2a92012 | |
parent | 9bc2123ee5bd7af4a8e1ca47696a3f3379d5a028 (diff) |
global-functions: validate syntax of modules
-rw-r--r-- | global-functions | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/global-functions b/global-functions index 7e359cf..397a10d 100644 --- a/global-functions +++ b/global-functions @@ -1267,7 +1267,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 |