Skip to content

Commit ec3b116

Browse files
committed
.
1 parent fd34003 commit ec3b116

File tree

3 files changed

+280
-161
lines changed

3 files changed

+280
-161
lines changed

devolutions-agent/src/updater/mod.rs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use self::product_actions::{ProductUpdateActions, build_product_actions};
2828
use self::productinfo::DEVOLUTIONS_PRODUCTINFO_URL;
2929
use self::security::set_file_dacl;
3030
use crate::config::ConfHandle;
31+
use crate::updater::productinfo::ProductInfoDb;
3132

3233
pub(crate) use self::error::UpdaterError;
3334
pub(crate) use self::product::Product;
@@ -261,15 +262,25 @@ async fn check_for_updates(product: Product, update_json: &UpdateJson) -> anyhow
261262
.await
262263
.context("failed to download productinfo database")?;
263264

264-
let parse_result = productinfo::parse_product_info(&product_info_json);
265+
let parse_result = ProductInfoDb::parse_product_info(&product_info_json);
265266

266267
let product_info = parse_result
267268
.db
268-
.lookup_msi_for_target_arch(product.get_productinfo_id(), &parse_result.errors)
269-
.ok_or_else(|| UpdaterError::ProductFileNotFound {
270-
product: product.get_productinfo_id().to_owned(),
271-
arch: productinfo::get_target_arch().to_owned(),
272-
file_type: "msi".to_owned(),
269+
.lookup_current_msi_for_target_arch(product.get_productinfo_id())
270+
.ok_or_else(|| {
271+
// At this point, log all parsing errors as warnings so we can investigate.
272+
for e in parse_result.errors {
273+
warn!(
274+
error = format!("{:#}", anyhow::Error::new(e)),
275+
"productinfo.json parsing error"
276+
);
277+
}
278+
279+
UpdaterError::ProductFileNotFound {
280+
product: product.get_productinfo_id().to_owned(),
281+
arch: productinfo::get_target_arch().to_owned(),
282+
file_type: "msi".to_owned(),
283+
}
273284
})?;
274285

275286
let remote_version = product_info.version.parse::<DateVersion>()?;

0 commit comments

Comments
 (0)