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

Function pull

crates/lib/src/deploy.rs:773–811  ·  view source on GitHub ↗

Wrapper for pulling a container image, wiring up status output.

(
    repo: &ostree::Repo,
    imgref: &ImageReference,
    target_imgref: Option<&OstreeImageReference>,
    quiet: bool,
    prog: ProgressWriter,
    booted_deployment: Option<&ostree::Deployment>,

Source from the content-addressed store, hash-verified

771
772/// Wrapper for pulling a container image, wiring up status output.
773pub(crate) async fn pull(
774 repo: &ostree::Repo,
775 imgref: &ImageReference,
776 target_imgref: Option<&OstreeImageReference>,
777 quiet: bool,
778 prog: ProgressWriter,
779 booted_deployment: Option<&ostree::Deployment>,
780) -> Result<Box<ImageState>> {
781 match prepare_for_pull(repo, imgref, target_imgref, booted_deployment).await? {
782 PreparedPullResult::AlreadyPresent(existing) => {
783 // Log that the image was already present (Debug level since it's not actionable)
784 const IMAGE_ALREADY_PRESENT_ID: &str = "5c4d3e2f1a0b9c8d7e6f5a4b3c2d1e0f9";
785 tracing::debug!(
786 message_id = IMAGE_ALREADY_PRESENT_ID,
787 bootc.image.reference = &imgref.image,
788 bootc.image.transport = &imgref.transport,
789 bootc.status = "already_present",
790 "Image already present: {}",
791 imgref
792 );
793 Ok(existing)
794 }
795 PreparedPullResult::Ready(prepared_image_meta) => {
796 // Check disk space before attempting to pull
797 check_disk_space_ostree(repo, &prepared_image_meta, imgref)?;
798 // Log that we're pulling a new image
799 const PULLING_NEW_IMAGE_ID: &str = "6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0";
800 tracing::info!(
801 message_id = PULLING_NEW_IMAGE_ID,
802 bootc.image.reference = &imgref.image,
803 bootc.image.transport = &imgref.transport,
804 bootc.status = "pulling_new",
805 "Pulling new image: {}",
806 imgref
807 );
808 Ok(pull_from_prepared(imgref, quiet, prog, *prepared_image_meta).await?)
809 }
810 }
811}
812
813pub(crate) async fn wipe_ostree(sysroot: Sysroot) -> Result<()> {
814 tokio::task::spawn_blocking(move || {

Callers 7

install_resetFunction · 0.85
upgradeFunction · 0.85
switch_ostreeFunction · 0.85
edit_ostreeFunction · 0.85
run_from_optFunction · 0.85
pull_composefs_directFunction · 0.85
pull_composefs_unifiedFunction · 0.85

Calls 3

prepare_for_pullFunction · 0.85
check_disk_space_ostreeFunction · 0.85
pull_from_preparedFunction · 0.85

Tested by

no test coverage detected