Skip to content

Commit 4f6069b

Browse files
committed
wip tests
1 parent 5b0cdac commit 4f6069b

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

crates/lib/src/cli.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -949,10 +949,15 @@ async fn upgrade(
949949
} else {
950950
// Check if image exists in bootc storage (/usr/lib/bootc/storage)
951951
let imgstore = sysroot.get_ensure_imgstore()?;
952-
let use_unified = match imgstore.exists(&format!("{imgref:#}")).await {
952+
953+
let image_ref_str = crate::utils::imageref_to_container_ref(imgref);
954+
955+
let use_unified = match imgstore.exists(&image_ref_str).await {
953956
Ok(v) => v,
954957
Err(e) => {
955-
tracing::warn!("Failed to check bootc storage for image: {e}; falling back to standard pull");
958+
tracing::warn!(
959+
"Failed to check bootc storage for image: {e}; falling back to standard pull"
960+
);
956961
false
957962
}
958963
};
@@ -1078,10 +1083,15 @@ async fn switch_ostree(
10781083

10791084
// Check if image exists in bootc storage (/usr/lib/bootc/storage)
10801085
let imgstore = sysroot.get_ensure_imgstore()?;
1081-
let use_unified = match imgstore.exists(&format!("{target:#}")).await {
1086+
1087+
let target_ref_str = crate::utils::imageref_to_container_ref(&target);
1088+
1089+
let use_unified = match imgstore.exists(&target_ref_str).await {
10821090
Ok(v) => v,
10831091
Err(e) => {
1084-
tracing::warn!("Failed to check bootc storage for image: {e}; falling back to standard pull");
1092+
tracing::warn!(
1093+
"Failed to check bootc storage for image: {e}; falling back to standard pull"
1094+
);
10851095
false
10861096
}
10871097
};
@@ -1480,9 +1490,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
14801490
ImageOpts::CopyToStorage { source, target } => {
14811491
crate::image::push_entrypoint(source.as_deref(), target.as_deref()).await
14821492
}
1483-
ImageOpts::SetUnified => {
1484-
crate::image::set_unified_entrypoint().await
1485-
}
1493+
ImageOpts::SetUnified => crate::image::set_unified_entrypoint().await,
14861494
ImageOpts::PullFromDefaultStorage { image } => {
14871495
let storage = get_storage().await?;
14881496
storage

crates/lib/src/deploy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ pub(crate) async fn prepare_for_pull_unified(
392392
// Get or initialize the bootc container storage (same as used for LBIs)
393393
let imgstore = store.get_ensure_imgstore()?;
394394

395-
let image_ref_str = format!("{imgref:#}");
395+
let image_ref_str = crate::utils::imageref_to_container_ref(imgref);
396396

397397
// Log the original transport being used for the pull
398398
tracing::info!(

crates/lib/src/image.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ pub(crate) async fn set_unified_entrypoint() -> Result<()> {
206206

207207
// Pull the image from its original source into bootc storage using LBI machinery
208208
let imgstore = sysroot.get_ensure_imgstore()?;
209-
let img_string = format!("{:#}", imgref);
209+
210+
let img_string = crate::utils::imageref_to_container_ref(imgref);
211+
210212
const SET_UNIFIED_JOURNAL_ID: &str = "1a0b9c8d7e6f5a4b3c2d1e0f9a8b7c6d";
211213
tracing::info!(
212214
message_id = SET_UNIFIED_JOURNAL_ID,
@@ -226,9 +228,11 @@ pub(crate) async fn set_unified_entrypoint() -> Result<()> {
226228
image: imgref.image.clone(),
227229
signature: imgref.signature.clone(),
228230
};
229-
let ostree_imgref = ostree_ext::container::OstreeImageReference::from(containers_storage_imgref);
230-
let _ = ostree_ext::container::store::ImageImporter::new(repo, &ostree_imgref, Default::default())
231-
.await?;
231+
let ostree_imgref =
232+
ostree_ext::container::OstreeImageReference::from(containers_storage_imgref);
233+
let _ =
234+
ostree_ext::container::store::ImageImporter::new(repo, &ostree_imgref, Default::default())
235+
.await?;
232236

233237
tracing::info!(
234238
message_id = SET_UNIFIED_JOURNAL_ID,

0 commit comments

Comments
 (0)