aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-08-24 19:39:59 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-08-29 08:58:50 +0200
commitf86cf27aa3cbfccf67d47f640b4ad0df64be09ae (patch)
treee97aa4c82a638b77dd3103db2d4b7319966414ea
parent07c6f5836a7e56d310890cf4bdaba1854205420f (diff)
backup-upload: detect failure creating config file
-rw-r--r--backup-upload.rsc19
1 files changed, 13 insertions, 6 deletions
diff --git a/backup-upload.rsc b/backup-upload.rsc
index 35b9b53..29bdfff 100644
--- a/backup-upload.rsc
+++ b/backup-upload.rsc
@@ -104,12 +104,19 @@ $WaitFullyConnected;
/file/add name=($FilePath . ".conf") contents=$Config;
$WaitForFile ($FilePath . ".conf");
- :do {
- /tool/fetch upload=yes url=($BackupUploadUrl . "/" . $FileName . ".conf") \
- user=$BackupUploadUser password=$BackupUploadPass src-path=($FilePath . ".conf");
- :set ConfigFile ($FileName . ".conf");
- } on-error={
- $LogPrintExit2 error $0 ("Uploading global-config-overlay failed!") false;
+ :local Size [ :len $Config ];
+ :if ([ /file/get ($FilePath . ".conf") size ] = $Size) do={
+ :do {
+ /tool/fetch upload=yes url=($BackupUploadUrl . "/" . $FileName . ".conf") \
+ user=$BackupUploadUser password=$BackupUploadPass src-path=($FilePath . ".conf");
+ :set ConfigFile ($FileName . ".conf");
+ } on-error={
+ $LogPrintExit2 error $0 ("Uploading global-config-overlay failed!") false;
+ :set ConfigFile "failed";
+ :set Failed 1;
+ }
+ } else={
+ $LogPrintExit2 warning $0 ("Creating config file failed. Size should be " . $Size . " bytes, but is not.") false;
:set ConfigFile "failed";
:set Failed 1;
}