MCPcopy Create free account
hub / github.com/bootc-dev/bootc / verify_target_fetch

Function verify_target_fetch

crates/lib/src/install.rs:1522–1541  ·  view source on GitHub ↗
(
    tmpdir: &Dir,
    imgref: &ostree_container::OstreeImageReference,
)

Source from the content-addressed store, hash-verified

1520/// Verify that we can load the manifest of the target image
1521#[context("Verifying fetch")]
1522async fn verify_target_fetch(
1523 tmpdir: &Dir,
1524 imgref: &ostree_container::OstreeImageReference,
1525) -> Result<()> {
1526 let tmpdir = &TempDir::new_in(&tmpdir)?;
1527 let tmprepo = &ostree::Repo::create_at_dir(tmpdir.as_fd(), ".", ostree::RepoMode::Bare, None)
1528 .context("Init tmp repo")?;
1529
1530 tracing::trace!("Verifying fetch for {imgref}");
1531 let mut imp =
1532 ostree_container::store::ImageImporter::new(tmprepo, imgref, Default::default()).await?;
1533 use ostree_container::store::PrepareResult;
1534 let prep = match imp.prepare().await? {
1535 // SAFETY: It's impossible that the image was already fetched into this newly created temporary repository
1536 PrepareResult::AlreadyPresent(_) => unreachable!(),
1537 PrepareResult::Ready(r) => r,
1538 };
1539 tracing::debug!("Fetched manifest with digest {}", prep.manifest_digest);
1540 Ok(())
1541}
1542
1543/// Preparation for an install; validates and prepares some (thereafter immutable) global state.
1544async fn prepare_install(

Callers 1

prepare_installFunction · 0.85

Calls 1

prepareMethod · 0.80

Tested by

no test coverage detected