Skip to content

Commit

Permalink
deploy: Add a no_clean option
Browse files Browse the repository at this point in the history
Looking at doing a bootc reinstall, we need the ability
to retain existing deployments for this.
  • Loading branch information
cgwalters committed Sep 30, 2023
1 parent ff2171b commit 8fa019b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/src/container/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ pub struct DeployOpts<'a> {
/// to a different container image, the fetch process will reuse shared layers, but
/// it will not be necessary to remove the previous image.
pub no_imgref: bool,

/// Do not cleanup deployments
pub no_clean: bool,
}

/// Write a container image to an OSTree deployment.
Expand Down Expand Up @@ -106,15 +109,21 @@ pub async fn deploy(
Some(&opts),
cancellable,
)?;
let flags = ostree::SysrootSimpleWriteDeploymentFlags::NONE;
let flags = if options.no_clean {
ostree::SysrootSimpleWriteDeploymentFlags::NO_CLEAN
} else {
ostree::SysrootSimpleWriteDeploymentFlags::NONE
};
sysroot.simple_write_deployment(
Some(stateroot),
deployment,
merge_deployment.as_ref(),
flags,
cancellable,
)?;
sysroot.cleanup(cancellable)?;
if !options.no_clean {
sysroot.cleanup(cancellable)?;
}
}

Ok(state)
Expand Down

0 comments on commit 8fa019b

Please sign in to comment.