aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2022-04-28 09:34:12 +0200
committerGravatar Christian Hesse <mail@eworm.de>2022-04-28 10:19:07 +0200
commit7c8e230521f1a936da034dfc05197fe9434926ed (patch)
treee650eb89ea406c792d42328d96210a33e2a92012 /global-functions
parent9bc2123ee5bd7af4a8e1ca47696a3f3379d5a028 (diff)
global-functions: validate syntax of modules
Diffstat (limited to 'global-functions')
-rw-r--r--global-functions7
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