From 24e955ff33c0dabf7fc9107db13ba7aa96acfca4 Mon Sep 17 00:00:00 2001 From: Manuel Sopena Ballesteros Date: Sun, 29 Sep 2024 22:03:48 +0200 Subject: [PATCH] fix: command 'migrate nodes' validate HSM groups refactor: housekeeping with module files --- .../mod.rs} | 0 .../mod.rs} | 0 .../mod.rs} | 0 .../mod.rs} | 0 src/cli/{commands.rs => commands/mod.rs} | 0 src/{cli.rs => cli/mod.rs} | 0 src/cli/process.rs | 21 +++++++++++++++++++ src/{common.rs => common/mod.rs} | 0 8 files changed, 21 insertions(+) rename src/cli/commands/{apply_hw_cluster_pin.rs => apply_hw_cluster_pin/mod.rs} (100%) rename src/cli/commands/{apply_hw_cluster_unpin.rs => apply_hw_cluster_unpin/mod.rs} (100%) rename src/cli/commands/{apply_sat_file.rs => apply_sat_file/mod.rs} (100%) rename src/cli/commands/{delete_sessions.rs => delete_sessions/mod.rs} (100%) rename src/cli/{commands.rs => commands/mod.rs} (100%) rename src/{cli.rs => cli/mod.rs} (100%) rename src/{common.rs => common/mod.rs} (100%) diff --git a/src/cli/commands/apply_hw_cluster_pin.rs b/src/cli/commands/apply_hw_cluster_pin/mod.rs similarity index 100% rename from src/cli/commands/apply_hw_cluster_pin.rs rename to src/cli/commands/apply_hw_cluster_pin/mod.rs diff --git a/src/cli/commands/apply_hw_cluster_unpin.rs b/src/cli/commands/apply_hw_cluster_unpin/mod.rs similarity index 100% rename from src/cli/commands/apply_hw_cluster_unpin.rs rename to src/cli/commands/apply_hw_cluster_unpin/mod.rs diff --git a/src/cli/commands/apply_sat_file.rs b/src/cli/commands/apply_sat_file/mod.rs similarity index 100% rename from src/cli/commands/apply_sat_file.rs rename to src/cli/commands/apply_sat_file/mod.rs diff --git a/src/cli/commands/delete_sessions.rs b/src/cli/commands/delete_sessions/mod.rs similarity index 100% rename from src/cli/commands/delete_sessions.rs rename to src/cli/commands/delete_sessions/mod.rs diff --git a/src/cli/commands.rs b/src/cli/commands/mod.rs similarity index 100% rename from src/cli/commands.rs rename to src/cli/commands/mod.rs diff --git a/src/cli.rs b/src/cli/mod.rs similarity index 100% rename from src/cli.rs rename to src/cli/mod.rs diff --git a/src/cli/process.rs b/src/cli/process.rs index 2a4151fb..8f5bfe94 100644 --- a/src/cli/process.rs +++ b/src/cli/process.rs @@ -1872,6 +1872,27 @@ pub async fn process_cli( let xnames_string: &String = cli_migrate_nodes.get_one("XNAMES").unwrap(); + // Validate user has access to 'from' HSM group + let _ = get_target_hsm_group_vec_or_all( + shasta_token, + shasta_base_url, + shasta_root_cert, + Some(from), + settings_hsm_group_name_opt, + ) + .await; + + // Validate user has access to 'to' HSM group + let _ = get_target_hsm_group_vec_or_all( + shasta_token, + shasta_base_url, + shasta_root_cert, + Some(to), + settings_hsm_group_name_opt, + ) + .await; + + // Migrate nodes add_nodes::exec( shasta_token, shasta_base_url, diff --git a/src/common.rs b/src/common/mod.rs similarity index 100% rename from src/common.rs rename to src/common/mod.rs