diff options
author | Christian Hesse <mail@eworm.de> | 2023-08-24 19:39:59 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2023-08-29 08:58:50 +0200 |
commit | f86cf27aa3cbfccf67d47f640b4ad0df64be09ae (patch) | |
tree | e97aa4c82a638b77dd3103db2d4b7319966414ea /backup-upload.rsc | |
parent | 07c6f5836a7e56d310890cf4bdaba1854205420f (diff) |
backup-upload: detect failure creating config file
Diffstat (limited to 'backup-upload.rsc')
-rw-r--r-- | backup-upload.rsc | 19 |
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; } |