src/api2/admin/datastore.rs: backup logs may not be written twice
This commit is contained in:
parent
ef3254c086
commit
e128d4e84f
@ -487,13 +487,17 @@ fn upload_backup_log(
|
|||||||
|
|
||||||
let backup_dir = BackupDir::new(backup_type, backup_id, backup_time);
|
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();
|
let mut path = datastore.base_path();
|
||||||
path.push(backup_dir.relative_path());
|
path.push(backup_dir.relative_path());
|
||||||
path.push(&file_name);
|
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
|
let resp = req_body
|
||||||
.map_err(Error::from)
|
.map_err(Error::from)
|
||||||
.fold(Vec::new(), |mut acc, chunk| {
|
.fold(Vec::new(), |mut acc, chunk| {
|
||||||
|
Loading…
Reference in New Issue
Block a user