diff --git a/Cargo.toml b/Cargo.toml index 2ecd5627..d7009796 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,8 +15,8 @@ publish = false # cargo dist --> Avoid publishing to crates.io # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -# mesa = "0.16.10" -mesa = { path = "../mesa" } # Only for development purposes +mesa = "0.16.11" +# mesa = { path = "../mesa" } # Only for development purposes chrono = "0.4.31" anyhow = "1.0.44" reqwest = { version = "0.11", features = ["blocking", "json", "rustls-tls", "socks"] } diff --git a/src/cli/commands/apply_image.rs b/src/cli/commands/apply_image.rs index e2894bf8..07ffc4d8 100644 --- a/src/cli/commands/apply_image.rs +++ b/src/cli/commands/apply_image.rs @@ -212,32 +212,7 @@ pub async fn exec( .await .unwrap(); - // Get CFS session logs - let logs_stream_rslt = kubernetes::get_cfs_session_container_git_clone_logs_stream( - client.clone(), - &cfs_session.name, - ) - .await; - - match logs_stream_rslt { - Ok(mut logs_stream) => { - while let Some(line) = logs_stream.try_next().await.unwrap() { - println!("{}", line); - } - } - Err(error_msg) => log::error!("{}", error_msg), - } - - let mut logs_stream = kubernetes::get_cfs_session_container_ansible_logs_stream( - client, - &cfs_session.name, - ) - .await - .unwrap(); - - while let Some(line) = logs_stream.try_next().await.unwrap() { - println!("{}", line); - } + kubernetes::print_cfs_session_logs(client, &cfs_session.name).await; } } diff --git a/src/cli/commands/log.rs b/src/cli/commands/log.rs index ddf0b410..6bfc5af1 100644 --- a/src/cli/commands/log.rs +++ b/src/cli/commands/log.rs @@ -1,7 +1,3 @@ -use std::error::Error; - -use futures::{io::Lines, AsyncBufReadExt, TryStreamExt}; - use mesa::shasta::{cfs, hsm, kubernetes}; use crate::common::vault::http_client::fetch_shasta_k8s_secrets; @@ -16,7 +12,6 @@ pub async fn exec( k8s_api_url: &str, cluster_name: Option<&String>, session_name: Option<&String>, - // layer_id: Option<&u8>, hsm_group_config: Option<&String>, ) { // Get CFS sessions @@ -57,46 +52,5 @@ pub async fn exec( .await .unwrap(); - // Get CFS session logs - let logs_stream_rslt = kubernetes::get_cfs_session_container_git_clone_logs_stream( - client.clone(), - &cfs_session_name, - ) - .await; - - match logs_stream_rslt { - Ok(mut logs_stream) => { - while let Some(line) = logs_stream.try_next().await.unwrap() { - println!("{}", line); - } - } - Err(error_msg) => log::error!("{}", error_msg), - } - - let mut logs_stream = - kubernetes::get_cfs_session_container_ansible_logs_stream(client, cfs_session_name) - .await - .unwrap(); - - while let Some(line) = logs_stream.try_next().await.unwrap() { - println!("{}", line); - } + kubernetes::print_cfs_session_logs(client, cfs_session_name).await; } - -/* pub async fn get_cfs_session_container_ansible_logs_stream( - vault_base_url: &str, - vault_secret_path: &str, - vault_role_id: &str, - cfs_session_name: &str, - k8s_api_url: &str, -) -> Result, Box> { - let shasta_k8s_secrets = - fetch_shasta_k8s_secrets(vault_base_url, vault_secret_path, vault_role_id).await; - - let client = kubernetes::get_k8s_client_programmatically(k8s_api_url, shasta_k8s_secrets) - .await - .unwrap(); - - // Get CFS session logs - kubernetes::get_cfs_session_container_ansible_logs_stream(client, cfs_session_name).await -} */