From b4d0e2fb818c5144a293d0583d4232eef9216661 Mon Sep 17 00:00:00 2001 From: Maxi Wittich Date: Mon, 11 Nov 2024 09:19:38 +0100 Subject: [PATCH] Adding code review --- rust/crd/src/authentication.rs | 1 + rust/crd/src/lib.rs | 14 +++++--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/rust/crd/src/authentication.rs b/rust/crd/src/authentication.rs index 4d64ef26..d769f163 100644 --- a/rust/crd/src/authentication.rs +++ b/rust/crd/src/authentication.rs @@ -765,6 +765,7 @@ mod tests { error_message ); } + #[tokio::test] async fn reject_wrong_principal_claim() { let error_message = test_resolve_and_expect_error( diff --git a/rust/crd/src/lib.rs b/rust/crd/src/lib.rs index 8721ed8a..7d7be665 100644 --- a/rust/crd/src/lib.rs +++ b/rust/crd/src/lib.rs @@ -341,12 +341,11 @@ impl AirflowRole { match &self { AirflowRole::Webserver => { // Getting auth commands for AuthClass - let auth_commands = vec![Self::authentication_start_commands(auth_config)]; + command.extend(Self::authentication_start_commands(auth_config)); command.extend(vec![ "prepare_signal_handlers".to_string(), "airflow webserver &".to_string(), ]); - command.extend(auth_commands); } AirflowRole::Scheduler => command.extend(vec![ @@ -377,9 +376,10 @@ impl AirflowRole { command } + fn authentication_start_commands( auth_config: &AirflowClientAuthenticationDetailsResolved, - ) -> String { + ) -> Vec { let mut commands = Vec::new(); let mut tls_client_credentials = BTreeSet::new(); @@ -401,13 +401,9 @@ impl AirflowRole { })); } - commands - .iter() - .flatten() - .cloned() - .collect::>() - .join("\n") + commands.iter().flatten().cloned().collect::>() } + // Adding certificate to the mount path for airflow startup commands fn add_cert_to_python_certifi_command(cert_file: &str) -> String { format!("cat {cert_file} >> \"$(python -c 'import certifi; print(certifi.where())')\"")