| 1917 | } |
| 1918 | |
| 1919 | fn helm_exec_with_output<STDOUT, STDERR>( |
| 1920 | args: &[&str], |
| 1921 | envs: &[(&str, &str)], |
| 1922 | stdout_output: &mut STDOUT, |
| 1923 | stderr_output: &mut STDERR, |
| 1924 | cmd_killer: &CommandKiller, |
| 1925 | ) -> Result<(), CommandError> |
| 1926 | where |
| 1927 | STDOUT: FnMut(String), |
| 1928 | STDERR: FnMut(String), |
| 1929 | { |
| 1930 | // Note: Helm CLI use spf13/cobra lib for the CLI; One function is mainly used to return an error if a command failed. |
| 1931 | // Helm returns an error each time a command does not succeed as they want. Which leads to handling error with status code 1 |
| 1932 | // It means that the command successfully ran, but it didn't terminate as expected |
| 1933 | let mut cmd = QoveryCommand::new("helm", args, envs); |
| 1934 | match cmd.exec_with_abort(stdout_output, stderr_output, cmd_killer) { |
| 1935 | Err(err) => Err(err), |
| 1936 | _ => Ok(()), |
| 1937 | } |
| 1938 | } |
| 1939 | |
| 1940 | pub fn to_engine_error(event_details: &EventDetails, error: HelmError) -> EngineError { |
| 1941 | EngineError::new_helm_error(event_details.clone(), error) |