diff options
author | Christian Hesse <mail@eworm.de> | 2019-04-01 11:12:34 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2019-04-01 12:39:37 +0200 |
commit | 40201ac1ea8e27492587d0cebdd0d6b8c24b733a (patch) | |
tree | 34bee7136c075ceae77b5053c0aacc6105693057 | |
parent | 6388a97f31a396de3fe147dfab2149b0cbff1af4 (diff) |
-rw-r--r-- | global-config.changes | 8 | ||||
-rw-r--r-- | script-updates | 23 |
2 files changed, 30 insertions, 1 deletions
diff --git a/global-config.changes b/global-config.changes new file mode 100644 index 0000000..7c430dc --- /dev/null +++ b/global-config.changes @@ -0,0 +1,8 @@ +# RouterOS global-config changes +# Copyright (c) 2019 Christian Hesse <mail@eworm.de> + +# Changes for global-config to be added to notification on script-updates +:global GlobalConfigChanges { + 1="moved variables from global-config to global-functions for independence"; + 2="variable names became CamelCase to work around scripting issues"; +}; diff --git a/script-updates b/script-updates index 971f2e4..d2390db 100644 --- a/script-updates +++ b/script-updates @@ -78,9 +78,30 @@ } :if ($GlobalConfigVersion < $ExpectedConfigVersion) do={ + :global GlobalConfigChanges; + :local ChangeLogCode; + :local Changes; + + :log debug ("Fetching changelog."); + :do { + :local Result [ / tool fetch check-certificate=yes-without-crl \ + ($ScriptUpdatesBaseUrl . "global-config.changes" . $ScriptUpdatesUrlSuffix) \ + output=user as-value ]; + :if ($Result->"status" = "finished") do={ + :set ChangeLogCode ($Result->"data"); + } + } on-error={ + :log info ("Failed fetching changes!"); + } + [ :parse $ChangeLogCode ]; + :for I from=($GlobalConfigVersion + 1) to=$ExpectedConfigVersion do={ + :set Changes ( $Changes . "\n * " . $GlobalConfigChanges->[ :tostr $I ] ); + } + $SendNotification "Configuration warning!" \ ("Current configuration on " . $Identity . " is out of date. " . \ "Please update global-config, then increase variable " . \ "GlobalConfigVersion (currently " . $GlobalConfigVersion . \ - ") to " . $ExpectedConfigVersion . " and re-run global-config."); + ") to " . $ExpectedConfigVersion . " and re-run global-config.\n\n" . \ + "Changes:" . $Changes); } |