diff --git a/bin/periphery/src/api/mod.rs b/bin/periphery/src/api/mod.rs index 7c8e89bff..b523c2dd7 100644 --- a/bin/periphery/src/api/mod.rs +++ b/bin/periphery/src/api/mod.rs @@ -156,15 +156,7 @@ impl Resolve for State { &self, PruneAll {}: PruneAll, _: (), - ) -> anyhow::Result> { - tokio::spawn(async move { - let mut logs = Vec::new(); - logs.push(docker::prune_images().await); - logs.push(docker::container::prune_containers().await); - logs.push(docker::network::prune_networks().await); - logs - }) - .await - .context("failure in spawned task") + ) -> anyhow::Result { + Ok(docker::prune_system().await) } } diff --git a/bin/periphery/src/helpers/docker/mod.rs b/bin/periphery/src/helpers/docker/mod.rs index bb6931c5c..903fa4b47 100644 --- a/bin/periphery/src/helpers/docker/mod.rs +++ b/bin/periphery/src/helpers/docker/mod.rs @@ -52,3 +52,8 @@ pub fn parse_extra_args(extra_args: &[String]) -> String { args } } + +pub async fn prune_system() -> Log { + let command = String::from("docker system prune -a -f"); + run_monitor_command("prune system", command).await +} diff --git a/client/periphery/rs/src/api/mod.rs b/client/periphery/rs/src/api/mod.rs index fd92fcf04..ffb3604bd 100644 --- a/client/periphery/rs/src/api/mod.rs +++ b/client/periphery/rs/src/api/mod.rs @@ -49,7 +49,7 @@ pub struct GetSecrets {} // #[derive(Serialize, Deserialize, Debug, Clone, Request)] -#[response(Vec)] +#[response(Log)] pub struct PruneAll {} //