Skip to content

Commit dc3e1fd

Browse files
committed
install: Clean up imageref handling
Prep for takeover installs, but also just a general cleanup. Rather than having `ContainerPolicyAllowInsecure` in multiple places, have it just once with an explicit rationale. Signed-off-by: Colin Walters <[email protected]>
1 parent aea91c8 commit dc3e1fd

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

lib/src/install.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,9 @@ async fn initialize_ostree_root_from_self(
425425
let digest = crate::podman::imageid_to_digest(&state.container_info.imageid)?;
426426
let src_image = crate::utils::digested_pullspec(&state.container_info.image, &digest);
427427

428-
let src_imageref = ostree_container::OstreeImageReference {
429-
sigverify: ostree_container::SignatureSource::ContainerPolicyAllowInsecure,
430-
imgref: ostree_container::ImageReference {
431-
transport: ostree_container::Transport::ContainerStorage,
432-
name: src_image.clone(),
433-
},
428+
let src_imageref = ostree_container::ImageReference {
429+
transport: ostree_container::Transport::ContainerStorage,
430+
name: src_image.clone(),
434431
};
435432

436433
// Parse the target CLI image reference options
@@ -504,6 +501,12 @@ async fn initialize_ostree_root_from_self(
504501
temporary_dir = Some(td);
505502
r
506503
};
504+
let src_imageref = ostree_container::OstreeImageReference {
505+
// There are no signatures to verify since we're fetching the already
506+
// pulled container.
507+
sigverify: ostree_container::SignatureSource::ContainerPolicyAllowInsecure,
508+
imgref: src_imageref,
509+
};
507510

508511
let kargs = root_setup
509512
.kargs
@@ -561,11 +564,11 @@ async fn initialize_ostree_root_from_self(
561564

562565
#[context("Copying to oci")]
563566
fn copy_to_oci(
564-
src_imageref: &ostree_container::OstreeImageReference,
567+
src_imageref: &ostree_container::ImageReference,
565568
dir: &Utf8Path,
566-
) -> Result<ostree_container::OstreeImageReference> {
569+
) -> Result<ostree_container::ImageReference> {
567570
tracing::debug!("Copying {src_imageref}");
568-
let src_imageref = &src_imageref.imgref.to_string();
571+
let src_imageref = src_imageref.to_string();
569572
let dest_imageref = ostree_container::ImageReference {
570573
transport: ostree_container::Transport::OciDir,
571574
name: dir.to_string(),
@@ -582,10 +585,7 @@ fn copy_to_oci(
582585
dest_imageref_str.as_str(),
583586
])
584587
.run()?;
585-
Ok(ostree_container::OstreeImageReference {
586-
sigverify: SignatureSource::ContainerPolicyAllowInsecure,
587-
imgref: dest_imageref,
588-
})
588+
Ok(dest_imageref)
589589
}
590590

591591
#[context("Querying skopeo version")]

0 commit comments

Comments
 (0)