Skip to content

Commit 2fc8a35

Browse files
authored
Merge pull request #981 from dlachaumepalo/damien/979-fix-client-snapshot-command-with-download-dir-option
Fix snapshot download command error with `--download-dir` option in client
2 parents 5a654fb + ad7f087 commit 2fc8a35

File tree

4 files changed

+4
-12
lines changed

4 files changed

+4
-12
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mithril-client/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-client"
3-
version = "0.3.3"
3+
version = "0.3.4"
44
description = "A Mithril Client"
55
authors = { workspace = true }
66
edition = { workspace = true }

mithril-client/src/dependencies/builder.rs

-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ impl DependenciesBuilder {
181181

182182
async fn build_snapshot_service(&mut self) -> StdResult<Arc<dyn SnapshotService>> {
183183
let snapshot_service = MithrilClientSnapshotService::new(
184-
self.config.clone(),
185184
self.get_snapshot_client().await?,
186185
self.get_certificate_client().await?,
187186
self.get_certificate_verifier().await?,

mithril-client/src/services/snapshot.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use std::{
55
};
66

77
use async_trait::async_trait;
8-
use config::Config;
98
use flate2::read::GzDecoder;
109
use mithril_common::{
1110
certificate_chain::CertificateVerifier,
@@ -81,9 +80,6 @@ pub trait SnapshotService: Sync + Send {
8180

8281
/// Service used by the Command to perform business oriented tasks.
8382
pub struct MithrilClientSnapshotService {
84-
/// Configuration settings
85-
config: Arc<Config>,
86-
8783
/// Snapshot HTTP client
8884
snapshot_client: Arc<SnapshotClient>,
8985

@@ -100,14 +96,12 @@ pub struct MithrilClientSnapshotService {
10096
impl MithrilClientSnapshotService {
10197
/// Create a new instance of the service.
10298
pub fn new(
103-
config: Arc<Config>,
10499
snapshot_client: Arc<SnapshotClient>,
105100
certificate_client: Arc<CertificateClient>,
106101
certificate_verifier: Arc<dyn CertificateVerifier>,
107102
immutable_digester: Arc<dyn ImmutableDigester>,
108103
) -> Self {
109104
Self {
110-
config,
111105
snapshot_client,
112106
certificate_client,
113107
certificate_verifier,
@@ -198,7 +192,6 @@ impl SnapshotService for MithrilClientSnapshotService {
198192
.download(snapshot, pathdir)
199193
.await
200194
.map_err(|e| format!("Could not download file in '{}': {e}", pathdir.display()))?;
201-
let db_pathdir = Path::new(&self.config.get_string("download_dir")?).join("db");
202195

203196
self.unpack_snapshot(&filepath, &unpack_dir)
204197
.await
@@ -211,12 +204,12 @@ impl SnapshotService for MithrilClientSnapshotService {
211204
})?;
212205
let unpacked_snapshot_digest = self
213206
.immutable_digester
214-
.compute_digest(&db_pathdir, &certificate.beacon)
207+
.compute_digest(&unpack_dir, &certificate.beacon)
215208
.await
216209
.map_err(|e| {
217210
format!(
218211
"Could not compute digest in '{}': {e}",
219-
db_pathdir.display()
212+
unpack_dir.display()
220213
)
221214
})?;
222215

0 commit comments

Comments
 (0)