From 17d7678e2dbd641cf6f2a6950709cfc2ad9ea129 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 16 Feb 2021 16:04:18 +0100 Subject: global-functions: drop support for attachment in notification e-mail --- check-certificates | 2 +- check-lte-firmware-upgrade | 2 +- check-routeros-update | 10 +++++----- cloud-backup | 2 +- global-functions | 9 +++------ upload-backup | 2 +- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/check-certificates b/check-certificates index e54b915..39b7e2c 100644 --- a/check-certificates +++ b/check-certificates @@ -98,7 +98,7 @@ $WaitFullyConnected; "Fingerprint: " . ($CertNewVal->"fingerprint") . "\n" . \ "Issuer: " . ([ $ParseKeyValueStore ($CertNewVal->"issuer") ]->"CN") . "\n" . \ "Validity: " . ($CertNewVal->"invalid-before") . " to " . ($CertNewVal->"invalid-after") . "\n" . \ - "Expires in: " . [ $FormatExpire ($CertNewVal->"expires-after") ]) "" "" "true"; + "Expires in: " . [ $FormatExpire ($CertNewVal->"expires-after") ]) "" "true"; $LogPrintExit info ("The certificate " . ($CertVal->"name") . " has been renewed.") false; } on-error={ $LogPrintExit debug ("Could not renew certificate " . ($CertVal->"name") . ".") false; diff --git a/check-lte-firmware-upgrade b/check-lte-firmware-upgrade index edbd5b1..a678fb6 100644 --- a/check-lte-firmware-upgrade +++ b/check-lte-firmware-upgrade @@ -30,7 +30,7 @@ "LTE interface " . $IntName . " on " . $Identity . ".\n\n" . \ "Interface: " . [ $CharacterReplace ($Info->"manufacturer" . " " . $Info->"model") ("\"") "" ] . "\n" . \ "Installed: " . ($Firmware->"installed") . "\n" . \ - "Available: " . ($Firmware->"latest")) "" "" "true"; + "Available: " . ($Firmware->"latest")) "" "true"; :set SentLteFirmwareUpgradeNotification ($Firmware->"latest"); } } diff --git a/check-routeros-update b/check-routeros-update index 297f726..412d84a 100644 --- a/check-routeros-update +++ b/check-routeros-update @@ -55,7 +55,7 @@ $LogPrintExit info ("Version " . $Update->"latest-version" . " is a patch release, updating...") false; $SendNotification ([ $SymbolForNotification "sparkles" ] . "RouterOS update") \ ("Version " . $Update->"latest-version" . " is a patch update for " . $Update->"channel" . \ - ", updating on " . $Identity . "...") $Link "" "true"; + ", updating on " . $Identity . "...") $Link "true"; $DoUpdate; } @@ -64,7 +64,7 @@ $LogPrintExit info ("Seen a neighbor running version " . $Update->"latest-version" . ", updating...") false; $SendNotification ([ $SymbolForNotification "sparkles" ] . "RouterOS update") \ ("Seen a neighbor running version " . $Update->"latest-version" . " from " . $Update->"channel" . \ - ", updating on " . $Identity . "...") $Link "" "true"; + ", updating on " . $Identity . "...") $Link "true"; $DoUpdate; } @@ -81,7 +81,7 @@ $LogPrintExit info ("Version " . $Update->"latest-version" . " is considered safe, updating...") false; $SendNotification ([ $SymbolForNotification "sparkles" ] . "RouterOS update") \ ("Version " . $Update->"latest-version" . " is considered safe for " . $Update->"channel" . \ - ", updating on " . $Identity . "...") $Link "" "true"; + ", updating on " . $Identity . "...") $Link "true"; $DoUpdate; } } @@ -103,7 +103,7 @@ $SendNotification ([ $SymbolForNotification "sparkles" ] . "RouterOS update") \ ("A new RouterOS version " . ($Update->"latest-version") . \ " is available for " . $Identity . ".\n\n" . \ - [ $DeviceInfo ]) $Link "" "true"; + [ $DeviceInfo ]) $Link "true"; :set SentRouterosUpdateNotification ($Update->"latest-version"); } @@ -116,7 +116,7 @@ $SendNotification ([ $SymbolForNotification "warning-sign" ] . "RouterOS version") \ ("A different RouterOS version " . ($Update->"latest-version") . \ " is available for " . $Identity . ", but it is a downgrade.\n\n" . \ - [ $DeviceInfo ]) $Link "" "true"; + [ $DeviceInfo ]) $Link "true"; $LogPrintExit info ("A different RouterOS version " . ($Update->"latest-version") . \ " is available for downgrade.") false; :set SentRouterosUpdateNotification ($Update->"latest-version"); diff --git a/cloud-backup b/cloud-backup index b4c9002..b8c4191 100644 --- a/cloud-backup +++ b/cloud-backup @@ -32,7 +32,7 @@ [ $DeviceInfo ] . "\n\n" . \ "Name: " . $Cloud->"name" . "\n" . \ "Size: " . $Cloud->"size" . " B (" . ($Cloud->"size" / 1024) . " KiB)\n" . \ - "Download key: " . $Cloud->"secret-download-key") "" "" "true"; + "Download key: " . $Cloud->"secret-download-key") "" "true"; } on-error={ $SendNotification ([ $SymbolForNotification "warning-sign" ] . "Cloud backup failed") \ ("Failed uploading backup for " . $Identity . " to cloud!\n\n" . [ $DeviceInfo ]); diff --git a/global-functions b/global-functions index 851e632..6434307 100644 --- a/global-functions +++ b/global-functions @@ -773,7 +773,6 @@ :local Subject [ :tostr $1 ]; :local Message [ :tostr $2 ]; :local Link [ :tostr $3 ]; - :local Attach [ :tostr $4 ]; :global Identity; :global EmailGeneralTo; @@ -792,8 +791,7 @@ subject=("[" . $Identity . "] " . $Subject) \ body=($Message . \ [ $IfThenElse ([ :len $Link ] > 0) ("\n\n" . $Link) "" ] . \ - [ $IfThenElse ([ :len $Signature ] > 0) ("\n-- \n" . $Signature) "" ]) \ - file=$Attach; + [ $IfThenElse ([ :len $Signature ] > 0) ("\n-- \n" . $Signature) "" ]); } on-error={ $LogPrintExit warning ("Failed sending notification mail!") false; } @@ -805,13 +803,12 @@ :local Subject [ :tostr $1 ]; :local Message [ :tostr $2 ]; :local Link [ :tostr $3 ]; - :local Attach [ :tostr $4 ]; - :local Silent [ :tostr $5 ]; + :local Silent [ :tostr $4 ]; :global SendEMail; :global SendTelegram; - $SendEMail $Subject $Message $Link $Attach; + $SendEMail $Subject $Message $Link; $SendTelegram $Subject $Message $Link $Silent; } diff --git a/upload-backup b/upload-backup index acb8399..1249f36 100644 --- a/upload-backup +++ b/upload-backup @@ -72,7 +72,7 @@ $SendNotification [ $IfThenElse ($Failed > 0) \ ("Backup and config export upload for " . $Identity . ".\n\n" . \ [ $DeviceInfo ] . "\n\n" . \ "Backup file: " . $BackupFile . "\n" . \ - "Config file: " . $ConfigFile) "" "" "true"; + "Config file: " . $ConfigFile) "" "true"; :if ($Failed = 1) do={ :error "An error occured!"; -- cgit v1.2.3-54-g00ecf