From b238c480ab744fa3e13d635dec3eedaa86211e02 Mon Sep 17 00:00:00 2001 From: Pakin Date: Mon, 11 Aug 2025 14:06:59 +0700 Subject: [PATCH] add unregister container --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/updater.rs | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 56c4cb6..5621d8e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2008,7 +2008,7 @@ dependencies = [ [[package]] name = "silserv" -version = "0.1.0" +version = "0.1.1" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index f973f8d..3d15077 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "silserv" -version = "0.1.0" +version = "0.1.1" edition = "2024" authors = ["pakin"] description = "Container manager service for testing" diff --git a/src/updater.rs b/src/updater.rs index 72d8e1c..c466a87 100644 --- a/src/updater.rs +++ b/src/updater.rs @@ -693,6 +693,10 @@ impl UpdateManager { "updater", format!("⚠️ Backup creation failed: {}", e) ); + + // unregister container + let _ = self.storage.delete_container(&container.container_id); + // Don't fail the update for backup issues Ok(()) } @@ -730,6 +734,8 @@ impl UpdateManager { .await .context("Failed to remove container")?; + let _ = self.storage.delete_container(container_id); + info!("✅ Container stopped and removed"); log_info!( self.log_manager, @@ -951,6 +957,10 @@ impl UpdateManager { async fn attempt_rollback(&self, container: &ManagedContainer) -> Result<()> { warn!("🔄 Attempting rollback for container: {}", container.name); + warn!("Cleaning up ... "); + + // let _ = self.storage.delete_container(&container.container_id); + // Implementation for rollback would go here // This could involve starting the backup image or the previous version