From 215e0994ec33ed983c06740715df2ae90d9a627b Mon Sep 17 00:00:00 2001 From: Omer Tuchfeld Date: Fri, 6 Sep 2024 19:12:26 +0200 Subject: [PATCH] cli: wipe_ostree in spawn_blocking Solves #778 Signed-off-by: Omer Tuchfeld --- lib/src/cli.rs | 3 +-- lib/src/deploy.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/src/cli.rs b/lib/src/cli.rs index c5bf5a1e..f08b0da2 100644 --- a/lib/src/cli.rs +++ b/lib/src/cli.rs @@ -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; @@ -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?; + tokio::task::spawn_blocking(move || crate::deploy::wipe_ostree(&sysroot)).await??; Ok(()) } }, diff --git a/lib/src/deploy.rs b/lib/src/deploy.rs index 67a5794e..b8046313 100644 --- a/lib/src/deploy.rs +++ b/lib/src/deploy.rs @@ -288,7 +288,7 @@ pub(crate) async fn prune_container_store(sysroot: &Storage) -> Result<()> { Ok(()) } -pub(crate) async fn wipe_ostree(sysroot: &Sysroot) -> Result<()> { +pub(crate) fn wipe_ostree(sysroot: &Sysroot) -> Result<()> { sysroot .write_deployments(&[], gio::Cancellable::NONE) .context("removing deployments")?;