| 350 | } |
| 351 | |
| 352 | pub fn uninstall<STDOUT, STDERR>( |
| 353 | &self, |
| 354 | chart: &ChartInfo, |
| 355 | envs: &[(&str, &str)], |
| 356 | cmd_killer: &CommandKiller, |
| 357 | stdout_output: &mut STDOUT, |
| 358 | stderr_output: &mut STDERR, |
| 359 | ) -> Result<(), HelmError> |
| 360 | where |
| 361 | STDOUT: FnMut(String), |
| 362 | STDERR: FnMut(String), |
| 363 | { |
| 364 | // If the release does not exist, we do not return an error |
| 365 | match self.check_release_exist(chart, envs) { |
| 366 | Ok(_) => {} |
| 367 | Err(ReleaseDoesNotExist(x)) => { |
| 368 | info!("Helm release `{x}` does not exist. Nothing to do"); |
| 369 | return Ok(()); |
| 370 | } |
| 371 | Err(err) => return Err(err), |
| 372 | } |
| 373 | |
| 374 | let timeout = format!("{}s", &chart.timeout_in_seconds); |
| 375 | let namespace = chart.get_namespace_string(); |
| 376 | let args = vec![ |
| 377 | "uninstall", |
| 378 | &chart.name, |
| 379 | "--namespace", |
| 380 | &namespace, |
| 381 | "--timeout", |
| 382 | &timeout, |
| 383 | "--wait", |
| 384 | "--cascade=foreground", |
| 385 | "--ignore-not-found", |
| 386 | "--debug", |
| 387 | ]; |
| 388 | |
| 389 | let mut stderr = String::new(); |
| 390 | let mut stderr_output = |line: String| { |
| 391 | stderr.push_str(&line); |
| 392 | stderr_output(line) |
| 393 | }; |
| 394 | match helm_exec_with_output(&args, &self.get_all_envs(envs), stdout_output, &mut stderr_output, cmd_killer) { |
| 395 | Err(err) => { |
| 396 | stderr.push_str(&err.to_string()); |
| 397 | Err(CmdError(chart.name.clone(), UNINSTALL, err.into())) |
| 398 | } |
| 399 | Ok(_) => Ok(()), |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | fn unlock_release(&self, chart: &ChartInfo, envs: &[(&str, &str)]) -> Result<(), HelmError> { |
| 404 | match self.check_release_exist(chart, envs) { |