fix #4591: pbs-client: backup_writer: improve error reporting

We check if the manifest contains an index for the requested archive, if
it does not we avoid downloading it and report a more helpful error
message.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
This commit is contained in:
Maximiliano Sandoval 2023-06-07 16:07:01 +02:00 committed by Fabian Grünbichler
parent 288893a6a9
commit 03e71cc8be

View File

@ -284,33 +284,41 @@ impl BackupWriter {
let close_path = format!("{}_close", prefix); let close_path = format!("{}_close", prefix);
if let Some(manifest) = options.previous_manifest { if let Some(manifest) = options.previous_manifest {
// try, but ignore errors if !manifest
match ArchiveType::from_path(archive_name) { .files()
Ok(ArchiveType::FixedIndex) => { .iter()
if let Err(err) = self .any(|file| file.filename == archive_name)
.download_previous_fixed_index( {
archive_name, log::info!("There is no index with the name {archive_name}");
&manifest, } else {
known_chunks.clone(), // try, but ignore errors
) match ArchiveType::from_path(archive_name) {
.await Ok(ArchiveType::FixedIndex) => {
{ if let Err(err) = self
log::warn!("Error downloading .fidx from previous manifest: {}", err); .download_previous_fixed_index(
archive_name,
&manifest,
known_chunks.clone(),
)
.await
{
log::warn!("Error downloading .fidx from previous manifest: {}", err);
}
} }
} Ok(ArchiveType::DynamicIndex) => {
Ok(ArchiveType::DynamicIndex) => { if let Err(err) = self
if let Err(err) = self .download_previous_dynamic_index(
.download_previous_dynamic_index( archive_name,
archive_name, &manifest,
&manifest, known_chunks.clone(),
known_chunks.clone(), )
) .await
.await {
{ log::warn!("Error downloading .didx from previous manifest: {}", err);
log::warn!("Error downloading .didx from previous manifest: {}", err); }
} }
_ => { /* do nothing */ }
} }
_ => { /* do nothing */ }
} }
} }