diff options
author | Christian Hesse <mail@eworm.de> | 2018-10-15 10:01:02 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2018-10-15 10:23:07 +0200 |
commit | 96fbb41b7e39ffe15ebb22f493eee0a1b910f55b (patch) | |
tree | c79197dc221d547d3a645f2f50543070f01fd8d4 | |
parent | bfca11c9ad391862a643f53e8a00c5a62743cc80 (diff) |
daily-psk: add error handling for fetch
-rw-r--r-- | daily-psk | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -13,7 +13,7 @@ # return pseudo-random string for PSK :local GeneratePSK do={ - :local date $1; + :local date [ :tostr $1 ]; :global "daily-psk-secrets"; @@ -84,9 +84,14 @@ "&level=1" . \ "&ssid=" . $ssid . \ "&pass=" . $newpsk); + :local attach "qrcode-daily.png"; - / tool fetch mode=https check-certificate=yes-without-crl address=$host host=$host \ - src-path=$srcpath dst-path=qrcode-daily.png; + :do { + / tool fetch mode=https check-certificate=yes-without-crl address=$host \ + host=$host src-path=$srcpath dst-path=$attach; + } on-error={ + :set attach ""; + } $SendNotification ("[" . $identity . "] daily PSK " . $ssid) \ ("This is the daily PSK on " . $identity . ":\n\n" . \ @@ -94,7 +99,7 @@ "PSK: " . $newpsk . "\n" . \ "Date: " . [ / system clock get date ] . "\n\n" . \ "https://" . $host . $srcpath) \ - "qrcode-daily.png"; + $attach; } } else={ :log debug ("Missing active interface " . $intname . " for access list entry."); |