diff --git a/tools/nymvisor/src/error.rs b/tools/nymvisor/src/error.rs index 71345793ae..75da67ee05 100644 --- a/tools/nymvisor/src/error.rs +++ b/tools/nymvisor/src/error.rs @@ -365,8 +365,12 @@ While the stored info point to:\n{stored_info:#?}" #[error("could not find the upgrade binary at {} while the binary download is disabled", path.display())] NoUpgradeBinaryWithDisabledDownload { path: PathBuf }, - #[error("upgrade '{upgrade_name}' does not have any valid download URLs for the current arch '{arch}'")] - NoDownloadUrls { upgrade_name: String, arch: String }, + #[error("upgrade '{upgrade_name}' does not have any valid download URLs for the current arch '{arch}'. The available arches are: {available:?}")] + NoDownloadUrls { + upgrade_name: String, + arch: String, + available: Vec, + }, #[error("failed to download the upgrade binary from '{url}': {source}")] UpgradeDownloadFailure { diff --git a/tools/nymvisor/src/tasks/launcher/backup.rs b/tools/nymvisor/src/tasks/launcher/backup.rs index ead125f6b4..b63c10aecd 100644 --- a/tools/nymvisor/src/tasks/launcher/backup.rs +++ b/tools/nymvisor/src/tasks/launcher/backup.rs @@ -3,6 +3,7 @@ use crate::config::NYMVISOR_DIR; use crate::error::NymvisorError; +use crate::helpers::init_path; use flate2::write::GzEncoder; use flate2::Compression; use std::fs; @@ -33,7 +34,11 @@ pub(crate) struct BackupBuilder { impl BackupBuilder { pub(crate) fn new>(backup_directory: P) -> Result { - let backup_filepath = backup_directory.as_ref().join(generate_backup_filename()); + let backup_directory = backup_directory.as_ref(); + let backup_filepath = backup_directory.join(generate_backup_filename()); + + // create the backup directory itself (i.e. specific for this upgrade) if it doesn't yet exist + init_path(backup_directory)?; // create the backup file let backup_file = fs::File::create(&backup_filepath).map_err(|source| { diff --git a/tools/nymvisor/src/tasks/launcher/mod.rs b/tools/nymvisor/src/tasks/launcher/mod.rs index bf5911215e..a091ba1866 100644 --- a/tools/nymvisor/src/tasks/launcher/mod.rs +++ b/tools/nymvisor/src/tasks/launcher/mod.rs @@ -182,7 +182,6 @@ impl DaemonLauncher { error!("CRITICAL FAILURE: the upgrade plan watcher channel got closed"); panic!("CRITICAL FAILURE: the upgrade plan watcher channel got closed") }; - println!("the file has changed - {event:?}"); debug!("the file has changed - {event:?}"); if let Some(next_upgrade) = self.check_upgrade_plan_changes() { diff --git a/tools/nymvisor/src/upgrades/download.rs b/tools/nymvisor/src/upgrades/download.rs index 1f71a4d722..1be5cf5252 100644 --- a/tools/nymvisor/src/upgrades/download.rs +++ b/tools/nymvisor/src/upgrades/download.rs @@ -35,6 +35,10 @@ async fn chunk_download( download_url: &DownloadUrl, download_target: &PathBuf, ) -> Result<(), NymvisorError> { + info!( + "attempting to download the binary from '{}'", + download_url.url + ); let response = reqwest::get(download_url.url.clone()) .await .map_err(|source| NymvisorError::UpgradeDownloadFailure { diff --git a/tools/nymvisor/src/upgrades/mod.rs b/tools/nymvisor/src/upgrades/mod.rs index 8964b68314..bb8ae36d60 100644 --- a/tools/nymvisor/src/upgrades/mod.rs +++ b/tools/nymvisor/src/upgrades/mod.rs @@ -48,7 +48,7 @@ pub(crate) async fn perform_upgrade(config: &Config) -> Result Result Result Self { + pub(crate) fn new>(save_path: P) -> Self { UpgradeHistory { - _save_path: None, + _save_path: Some(save_path.as_ref().to_path_buf()), history: vec![], } } @@ -424,7 +425,7 @@ impl UpgradeHistory { pub(crate) fn try_load>(path: P) -> Result { let path = path.as_ref(); - fs::File::open(path) + let mut history: UpgradeHistory = fs::File::open(path) .and_then(|file| { serde_json::from_reader(file) .map_err(|serde_json_err| io::Error::new(io::ErrorKind::Other, serde_json_err)) @@ -432,7 +433,10 @@ impl UpgradeHistory { .map_err(|source| NymvisorError::UpgradeHistoryLoadFailure { path: path.to_path_buf(), source, - }) + })?; + + history._save_path = Some(path.to_path_buf()); + Ok(history) } }