Skip to content

Commit 6956054

Browse files
committed
deploy: Change pull function to take sysroot
Prep for a podman backend, where we will write outside of the ostree repo. Signed-off-by: Colin Walters <[email protected]>
1 parent f7036d5 commit 6956054

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/src/cli.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ async fn upgrade(opts: UpgradeOpts) -> Result<()> {
294294
}
295295
}
296296
} else {
297-
let fetched = crate::deploy::pull(&sysroot.repo(), imgref, opts.quiet).await?;
297+
let fetched = crate::deploy::pull(&sysroot, imgref, opts.quiet).await?;
298298
let staged_digest = staged_image.as_ref().map(|s| s.image_digest.as_str());
299299
let fetched_digest = fetched.manifest_digest.as_str();
300300
tracing::debug!("staged: {staged_digest:?}");
@@ -371,7 +371,7 @@ async fn switch(opts: SwitchOpts) -> Result<()> {
371371
}
372372
let new_spec = RequiredHostSpec::from_spec(&new_spec)?;
373373

374-
let fetched = crate::deploy::pull(repo, &target, opts.quiet).await?;
374+
let fetched = crate::deploy::pull(sysroot, &target, opts.quiet).await?;
375375

376376
if !opts.retain {
377377
// By default, we prune the previous ostree ref so it will go away after later upgrades
@@ -395,7 +395,6 @@ async fn switch(opts: SwitchOpts) -> Result<()> {
395395
async fn edit(opts: EditOpts) -> Result<()> {
396396
prepare_for_write().await?;
397397
let sysroot = &get_locked_sysroot().await?;
398-
let repo = &sysroot.repo();
399398
let (booted_deployment, _deployments, host) =
400399
crate::status::get_status_require_booted(sysroot)?;
401400
let new_host: Host = if let Some(filename) = opts.filename {
@@ -414,7 +413,7 @@ async fn edit(opts: EditOpts) -> Result<()> {
414413
return Ok(());
415414
}
416415
let new_spec = RequiredHostSpec::from_spec(&new_host.spec)?;
417-
let fetched = crate::deploy::pull(repo, new_spec.image, opts.quiet).await?;
416+
let fetched = crate::deploy::pull(sysroot, new_spec.image, opts.quiet).await?;
418417

419418
// TODO gc old layers here
420419

lib/src/deploy.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ pub(crate) async fn new_importer(
5454
/// Wrapper for pulling a container image, wiring up status output.
5555
#[context("Pulling")]
5656
pub(crate) async fn pull(
57-
repo: &ostree::Repo,
57+
sysroot: &SysrootLock,
5858
imgref: &ImageReference,
5959
quiet: bool,
6060
) -> Result<Box<LayeredImageState>> {
61+
let repo = &sysroot.repo();
6162
let imgref = &OstreeImageReference::from(imgref.clone());
6263
let mut imp = new_importer(repo, imgref).await?;
6364
let prep = match imp.prepare().await? {

0 commit comments

Comments
 (0)