diff --git a/Cargo.toml b/Cargo.toml index e34e70dc..5ff9ec27 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,8 +16,8 @@ publish = false # cargo # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -# mesa = "0.40.11" -mesa = { path = "../mesa" } # Only for development purposes +mesa = "0.40.12" +# mesa = { path = "../mesa" } # Only for development purposes strum = "0.25.0" strum_macros = "0.25" chrono = "0.4.31" diff --git a/src/cli/build.rs b/src/cli/build.rs index a469c5b0..55701c71 100644 --- a/src/cli/build.rs +++ b/src/cli/build.rs @@ -152,7 +152,7 @@ pub fn build_cli(hsm_group: Option<&String>) -> Command { .subcommand(Command::new("stop-running-session") .visible_alias("srs") .arg_required_else_help(true) - .about("Stops a session") + .about("WIP - Stops a session") .arg(arg!(<SESSION_NAME> "Session name to stop").required(true)) ) } diff --git a/src/cli/commands/apply_cluster.rs b/src/cli/commands/apply_cluster.rs index 254740de..75b4b363 100644 --- a/src/cli/commands/apply_cluster.rs +++ b/src/cli/commands/apply_cluster.rs @@ -16,6 +16,7 @@ pub async fn exec( hsm_group_available_vec: &Vec<String>, ansible_verbosity_opt: Option<u8>, ansible_passthrough_opt: Option<&String>, + gitea_base_url: &str, gitea_token: &str, // tag: &str, do_not_reboot: bool, @@ -35,6 +36,7 @@ pub async fn exec( hsm_group_available_vec, ansible_verbosity_opt, ansible_passthrough_opt, + gitea_base_url, gitea_token, do_not_reboot, None, diff --git a/src/cli/commands/apply_configuration.rs b/src/cli/commands/apply_configuration.rs index 42786113..976e0e35 100644 --- a/src/cli/commands/apply_configuration.rs +++ b/src/cli/commands/apply_configuration.rs @@ -24,6 +24,7 @@ pub async fn exec( vault_secret_path: &str, vault_role_id: &str, k8s_api_url: &str, + gitea_base_url: &str, gitea_token: &str, // tag: &str, output_opt: Option<&String>, @@ -100,6 +101,7 @@ pub async fn exec( shasta_token, shasta_base_url, shasta_root_cert, + gitea_base_url, gitea_token, &cray_product_catalog, configuration_yaml, diff --git a/src/cli/commands/apply_image.rs b/src/cli/commands/apply_image.rs index f3284ba6..741d912a 100644 --- a/src/cli/commands/apply_image.rs +++ b/src/cli/commands/apply_image.rs @@ -33,6 +33,7 @@ pub async fn exec( // tag: &str, hsm_group_available_vec: &[String], k8s_api_url: &str, + gitea_base_url: &str, gitea_token: &str, _output_opt: Option<&String>, ) { @@ -152,6 +153,7 @@ pub async fn exec( shasta_token, shasta_base_url, shasta_root_cert, + gitea_base_url, gitea_token, &cray_product_catalog, configuration_yaml, diff --git a/src/cli/commands/apply_sat_file.rs b/src/cli/commands/apply_sat_file.rs index 72e812ad..172ae7a1 100644 --- a/src/cli/commands/apply_sat_file.rs +++ b/src/cli/commands/apply_sat_file.rs @@ -28,9 +28,8 @@ use crate::{ common::{ self, sat_file::{ - self, import_images_section_in_sat_file, - sessiontemplate::{Image, ImsDetails}, - validate_sat_file_configurations_section, validate_sat_file_images_section, SatFile, + self, import_images_section_in_sat_file, validate_sat_file_configurations_section, + validate_sat_file_images_section, SatFile, }, }, }; @@ -50,6 +49,7 @@ pub async fn exec( hsm_group_available_vec: &Vec<String>, ansible_verbosity_opt: Option<u8>, ansible_passthrough_opt: Option<&String>, + gitea_base_url: &str, gitea_token: &str, do_not_reboot: bool, prehook: Option<&String>, @@ -318,6 +318,7 @@ pub async fn exec( shasta_token, shasta_base_url, shasta_root_cert, + gitea_base_url, gitea_token, &cray_product_catalog, configuration_yaml, diff --git a/src/cli/process.rs b/src/cli/process.rs index 87076bb1..48901d79 100644 --- a/src/cli/process.rs +++ b/src/cli/process.rs @@ -1061,6 +1061,7 @@ pub async fn process_cli( vault_secret_path, vault_role_id, k8s_api_url, + gitea_base_url, gitea_token, // &tag, cli_apply_configuration.get_one::<String>("output"), @@ -1188,6 +1189,7 @@ pub async fn process_cli( // &tag, &hsm_group_available_vec, k8s_api_url, + gitea_base_url, gitea_token, cli_apply_image.get_one::<String>("output"), ) @@ -1246,6 +1248,7 @@ pub async fn process_cli( .cloned() .map(|ansible_verbosity| ansible_verbosity.parse::<u8>().unwrap()), cli_apply_cluster.get_one::<String>("ansible-passthrough"), + gitea_base_url, gitea_token, // &tag, *cli_apply_cluster @@ -1327,6 +1330,7 @@ pub async fn process_cli( .cloned() .map(|ansible_verbosity| ansible_verbosity.parse::<u8>().unwrap()), ansible_passthrough.as_ref(), + gitea_base_url, gitea_token, cli_apply_sat_file.get_flag("do-not-reboot"), prehook, diff --git a/src/common/sat_file.rs b/src/common/sat_file.rs index 54d0133b..1bba5aef 100644 --- a/src/common/sat_file.rs +++ b/src/common/sat_file.rs @@ -107,6 +107,10 @@ impl SatFile { .as_mut() .unwrap_or(&mut Vec::new()) .retain(|image| image_name_sessiontemplate_vec.contains(&image.name)); + + if self.images.as_ref().is_some_and(|images| images.is_empty()) { + self.images = None; + } } } } @@ -325,10 +329,6 @@ pub mod configuration { #[derive(Deserialize, Serialize, Debug)] #[serde(untagged)] // <-- this is important. More info https://serde.rs/enum-representations.html#untagged pub enum Product { - ProductVersion { - name: String, - version: String, - }, ProductVersionBranch { name: String, version: Option<String>, @@ -339,6 +339,10 @@ pub mod configuration { version: Option<String>, commit: String, }, + ProductVersion { + name: String, + version: String, + }, } #[derive(Deserialize, Serialize, Debug)] @@ -618,6 +622,7 @@ pub async fn create_cfs_configuration_from_sat_file( shasta_token: &str, shasta_base_url: &str, shasta_root_cert: &[u8], + gitea_base_url: &str, gitea_token: &str, cray_product_catalog: &BTreeMap<String, String>, sat_file_configuration_yaml: &serde_yaml::Value, @@ -630,6 +635,7 @@ pub async fn create_cfs_configuration_from_sat_file( let mut cfs_configuration = CfsConfigurationRequest::from_sat_file_serde_yaml( shasta_root_cert, + gitea_base_url, gitea_token, sat_file_configuration_yaml, cray_product_catalog,