Skip to content

Commit b1bd9c1

Browse files
Johan-Liebert1allisonkarlitskaya
authored andcommitted
Update return type of oci::pull
Move the printing of SHA256 and verity from the library to cfsctl binary. Signed-off-by: Pragyan Poudyal <[email protected]>
1 parent a4cbd3e commit b1bd9c1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/bin/cfsctl.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,10 @@ async fn main() -> Result<()> {
228228
println!("{}", image_id.to_id());
229229
}
230230
OciCommand::Pull { ref image, name } => {
231-
oci::pull(&Arc::new(repo), image, name.as_deref()).await?
231+
let (sha256, verity) = oci::pull(&Arc::new(repo), image, name.as_deref()).await?;
232+
233+
println!("sha256 {}", hex::encode(sha256));
234+
println!("verity {}", verity.to_hex());
232235
}
233236
OciCommand::Seal {
234237
ref config_name,

src/oci/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ pub async fn pull(
238238
repo: &Arc<Repository<impl FsVerityHashValue>>,
239239
imgref: &str,
240240
reference: Option<&str>,
241-
) -> Result<()> {
241+
) -> Result<(Sha256Digest, impl FsVerityHashValue)> {
242242
let op = Arc::new(ImageOp::new(repo, imgref).await?);
243243
let (sha256, id) = op
244244
.pull()
@@ -248,9 +248,7 @@ pub async fn pull(
248248
if let Some(name) = reference {
249249
repo.name_stream(sha256, name)?;
250250
}
251-
println!("sha256 {}", hex::encode(sha256));
252-
println!("verity {}", id.to_hex());
253-
Ok(())
251+
Ok((sha256, id))
254252
}
255253

256254
pub fn open_config<ObjectID: FsVerityHashValue>(

0 commit comments

Comments
 (0)