if let Some(verify) = update.verify {
data.verify = verify
}
+ if let Some(ignore_errors) = update.ignore_errors {
+ data.ignore_errors = ignore_errors
+ }
config.set_data(&id, "mirror", &data)?;
proxmox_offline_mirror::config::save_config(&config_file, &config)?;
sync: {
type: bool,
},
+ "ignore-errors": {
+ type: bool,
+ optional: true,
+ default: false,
+ },
}
)]
#[derive(Clone, Debug, Serialize, Deserialize, Updater)]
/// Use subscription key to access (required for Proxmox Enterprise repositories).
#[serde(skip_serializing_if = "Option::is_none")]
pub use_subscription: Option<ProductType>,
+ /// Whether to downgrade download errors to warnings
+ #[serde(default)]
+ pub ignore_errors: bool,
}
#[api(
pub sync: bool,
pub auth: Option<String>,
pub client: Client,
+ pub ignore_errors: bool,
}
impl TryInto<ParsedMirrorConfig> for MirrorConfig {
sync: self.sync,
auth: None,
client,
+ ignore_errors: self.ignore_errors,
})
}
}
let mut full_path = PathBuf::from(prefix);
full_path.push(&package.file);
- let res = fetch_plain_file(
+ match fetch_plain_file(
&config,
&url,
&full_path,
&package.checksums,
false,
dry_run,
- )?;
- fetch_progress.update(&res);
+ ) {
+ Ok(res) => fetch_progress.update(&res),
+ Err(err) if config.ignore_errors => {
+ let msg = format!(
+ "{}: failed to fetch package '{}' - {}",
+ basename, package.file, err,
+ );
+ eprintln!("{msg}");
+ }
+ res => {
+ res?;
+ }
+ }
}
if fetch_progress.file_count() % (max(total_files / 100, 1)) == 0 {