Skip to content

Commit de8b477

Browse files
committed
wip tests
1 parent 4efcf49 commit de8b477

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
@@ -944,10 +944,15 @@ async fn upgrade(
944944
} else {
945945
// Check if image exists in bootc storage (/usr/lib/bootc/storage)
946946
let imgstore = sysroot.get_ensure_imgstore()?;
947-
let use_unified = match imgstore.exists(&format!("{imgref:#}")).await {
947+
948+
let image_ref_str = crate::utils::imageref_to_container_ref(imgref);
949+
950+
let use_unified = match imgstore.exists(&image_ref_str).await {
948951
Ok(v) => v,
949952
Err(e) => {
950-
tracing::warn!("Failed to check bootc storage for image: {e}; falling back to standard pull");
953+
tracing::warn!(
954+
"Failed to check bootc storage for image: {e}; falling back to standard pull"
955+
);
951956
false
952957
}
953958
};
@@ -1073,10 +1078,15 @@ async fn switch_ostree(
10731078

10741079
// Check if image exists in bootc storage (/usr/lib/bootc/storage)
10751080
let imgstore = sysroot.get_ensure_imgstore()?;
1076-
let use_unified = match imgstore.exists(&format!("{target:#}")).await {
1081+
1082+
let target_ref_str = crate::utils::imageref_to_container_ref(&target);
1083+
1084+
let use_unified = match imgstore.exists(&target_ref_str).await {
10771085
Ok(v) => v,
10781086
Err(e) => {
1079-
tracing::warn!("Failed to check bootc storage for image: {e}; falling back to standard pull");
1087+
tracing::warn!(
1088+
"Failed to check bootc storage for image: {e}; falling back to standard pull"
1089+
);
10801090
false
10811091
}
10821092
};
@@ -1473,9 +1483,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
14731483
ImageOpts::CopyToStorage { source, target } => {
14741484
crate::image::push_entrypoint(source.as_deref(), target.as_deref()).await
14751485
}
1476-
ImageOpts::SetUnified => {
1477-
crate::image::set_unified_entrypoint().await
1478-
}
1486+
ImageOpts::SetUnified => crate::image::set_unified_entrypoint().await,
14791487
ImageOpts::PullFromDefaultStorage { image } => {
14801488
let storage = get_storage().await?;
14811489
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)