Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: wipe_ostree in spawn_blocking #779

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use ostree_ext::keyfileext::KeyFileExt;
use ostree_ext::ostree;
use schemars::schema_for;

use crate::deploy::wipe_ostree;
use crate::deploy::RequiredHostSpec;
use crate::lints;
use crate::spec::Host;
Expand Down Expand Up @@ -929,7 +928,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
StateOpts::WipeOstree => {
let sysroot = ostree::Sysroot::new_default();
sysroot.load(gio::Cancellable::NONE)?;
wipe_ostree(&sysroot).await?;
crate::deploy::wipe_ostree(sysroot).await?;
Ok(())
}
},
Expand Down
11 changes: 7 additions & 4 deletions lib/src/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,13 @@ pub(crate) async fn prune_container_store(sysroot: &Storage) -> Result<()> {
Ok(())
}

pub(crate) async fn wipe_ostree(sysroot: &Sysroot) -> Result<()> {
sysroot
.write_deployments(&[], gio::Cancellable::NONE)
.context("removing deployments")?;
pub(crate) async fn wipe_ostree(sysroot: Sysroot) -> Result<()> {
tokio::task::spawn_blocking(move || {
sysroot
.write_deployments(&[], gio::Cancellable::NONE)
.context("removing deployments")
})
.await??;

Ok(())
}
Expand Down