diff --git a/README.md b/README.md index 30fd017..dc3500f 100644 --- a/README.md +++ b/README.md @@ -158,12 +158,12 @@ sudo apt-get install -y gcc make libssl-dev pkg-config - [ ] Fix pod naming to avoid collisions - Deployments - [x] Apply - - [ ] Remove + - [x] Remove - [x] List - [x] Output matches kubectl - Daemonsets - [x] Apply - - [ ] Remove + - [x] Remove - [x] List - [x] Output matches kubectl - Ingress diff --git a/src/executor.rs b/src/executor.rs index 91bc5d8..003c537 100644 --- a/src/executor.rs +++ b/src/executor.rs @@ -294,7 +294,7 @@ impl DefaultExecutor { let ids = exec_cmd("podman", &["pod", "ls", "--filter", &format!("label=skate.io/namespace={}", ns), "--filter", &format!("label=skate.io/deployment={}", name), "-q"])?; - let ids = ids.split("\n").collect::>(); + let ids = ids.split("\n").map(|l| l.trim()).filter(|l| !l.is_empty()).collect::>(); self.remove_pods(ids, grace_period) } @@ -304,10 +304,9 @@ impl DefaultExecutor { let ns = daemonset.metadata.namespace.unwrap_or("default".to_string()); let ids = exec_cmd("podman", &["pod", "ls", "--filter", &format!("label=skate.io/namespace={}", ns), "--filter", &format!("label=skate.io/daemonset={}", name), "-q"])?; - let ids = ids.split("\n").collect::>(); - let result = self.remove_pods(ids, grace_period); - let _ = self.reload_ingress(); - result + let ids = ids.split("\n").map(|l| l.trim()).filter(|l| !l.is_empty()).collect::>(); + + self.remove_pods(ids, grace_period) } fn remove_pods(&self, ids: Vec<&str>, grace_period: Option) -> Result<(), Box> {