src/api2/admin/datastore.rs: backup logs may not be written twice

This commit is contained in:
Dietmar Maurer 2019-07-25 12:23:33 +02:00
parent ef3254c086
commit e128d4e84f
1 changed files with 7 additions and 3 deletions

View File

@ -487,13 +487,17 @@ fn upload_backup_log(
let backup_dir = BackupDir::new(backup_type, backup_id, backup_time);
println!("Upload backup log to {}/{}/{}/{}/{}", store,
backup_type, backup_id, BackupDir::backup_time_to_string(backup_dir.backup_time()), file_name);
let mut path = datastore.base_path();
path.push(backup_dir.relative_path());
path.push(&file_name);
if path.exists() {
bail!("backup already contains a log.");
}
println!("Upload backup log to {}/{}/{}/{}/{}", store,
backup_type, backup_id, BackupDir::backup_time_to_string(backup_dir.backup_time()), file_name);
let resp = req_body
.map_err(Error::from)
.fold(Vec::new(), |mut acc, chunk| {