Skip to content

Fix snapshot download command error with --download-dir option in client #981

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mithril-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-client"
version = "0.3.3"
version = "0.3.4"
description = "A Mithril Client"
authors = { workspace = true }
edition = { workspace = true }
Expand Down
1 change: 0 additions & 1 deletion mithril-client/src/dependencies/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ impl DependenciesBuilder {

async fn build_snapshot_service(&mut self) -> StdResult<Arc<dyn SnapshotService>> {
let snapshot_service = MithrilClientSnapshotService::new(
self.config.clone(),
self.get_snapshot_client().await?,
self.get_certificate_client().await?,
self.get_certificate_verifier().await?,
Expand Down
11 changes: 2 additions & 9 deletions mithril-client/src/services/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use std::{
};

use async_trait::async_trait;
use config::Config;
use flate2::read::GzDecoder;
use mithril_common::{
certificate_chain::CertificateVerifier,
Expand Down Expand Up @@ -81,9 +80,6 @@ pub trait SnapshotService: Sync + Send {

/// Service used by the Command to perform business oriented tasks.
pub struct MithrilClientSnapshotService {
/// Configuration settings
config: Arc<Config>,

/// Snapshot HTTP client
snapshot_client: Arc<SnapshotClient>,

Expand All @@ -100,14 +96,12 @@ pub struct MithrilClientSnapshotService {
impl MithrilClientSnapshotService {
/// Create a new instance of the service.
pub fn new(
config: Arc<Config>,
snapshot_client: Arc<SnapshotClient>,
certificate_client: Arc<CertificateClient>,
certificate_verifier: Arc<dyn CertificateVerifier>,
immutable_digester: Arc<dyn ImmutableDigester>,
) -> Self {
Self {
config,
snapshot_client,
certificate_client,
certificate_verifier,
Expand Down Expand Up @@ -198,7 +192,6 @@ impl SnapshotService for MithrilClientSnapshotService {
.download(snapshot, pathdir)
.await
.map_err(|e| format!("Could not download file in '{}': {e}", pathdir.display()))?;
let db_pathdir = Path::new(&self.config.get_string("download_dir")?).join("db");

self.unpack_snapshot(&filepath, &unpack_dir)
.await
Expand All @@ -211,12 +204,12 @@ impl SnapshotService for MithrilClientSnapshotService {
})?;
let unpacked_snapshot_digest = self
.immutable_digester
.compute_digest(&db_pathdir, &certificate.beacon)
.compute_digest(&unpack_dir, &certificate.beacon)
.await
.map_err(|e| {
format!(
"Could not compute digest in '{}': {e}",
db_pathdir.display()
unpack_dir.display()
)
})?;

Expand Down