Skip to content

Commit

Permalink
feat: power commands now support hostlist and regex
Browse files Browse the repository at this point in the history
feat: power commands now shows a dialog asking for permission to proceed
feati!: command power on cluster has new argument to skip prompts
feat!: command power on nodes has new argument to skip prompts
feat!: command power off cluster has new argument to skip prompts
feat!: command power off nodes has new argument to skip prompts
feat!: command power reset cluster has new argument to skip prompts
feat!: command power reset nodes has new argument to skip prompts
feat!: command apply boot nodes has new argument to skip prompts
feat!: command apply set boot image has new argument to skip prompts
feat!: command apply apply boot cluster has new argument to skip prompts
feat: add log level information to command config show
feat: images containing 'generic' in their names are now available to all users
fix: command apply session
  • Loading branch information
Manuel Sopena Ballesteros committed Oct 25, 2024
1 parent f0f6191 commit 88bea67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
23 changes: 6 additions & 17 deletions src/cli/commands/apply_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ pub async fn check_nodes_are_ready_to_run_cfs_configuration_and_run_cfs_session(
)
.await?;

// FIXME: things to fix:
// - extend the list of nodes checked being modified byt also including those in CFS sessions
// working against HSM groups (and not just 'ansible limit')
// - get also the list of CFS sessions affecting those nodes
let nodes_in_running_or_pending_cfs_session: Vec<&str> = cfs_sessions
.iter()
.filter(|cfs_session| {
Expand Down Expand Up @@ -271,7 +275,7 @@ pub async fn check_nodes_are_ready_to_run_cfs_configuration_and_run_cfs_session(
for node in nodes_list {
if nodes_in_running_or_pending_cfs_session.contains(&node) {
eprintln!(
"The node {} from the list provided is already assigned to a running/pending CFS session. Please try again latter. Exitting", node
"The node '{}' from the list provided is already assigned to a running/pending CFS session. Please try again latter or delete the CFS session. Exitting", node
);
std::process::exit(1);
}
Expand Down Expand Up @@ -421,7 +425,7 @@ pub async fn check_nodes_are_ready_to_run_cfs_configuration_and_run_cfs_session(
.interact()
.unwrap()
{
println!("Continue. Creating new CFS configuration and layer");
println!("Continue. Creating new CFS configuration and layer(s)");
} else {
println!("Cancelled by user. Aborting.");
std::process::exit(0);
Expand All @@ -442,12 +446,6 @@ pub async fn check_nodes_are_ready_to_run_cfs_configuration_and_run_cfs_session(
)
.await;

// Update/PUT CFS configuration
log::info!(
"Create CFS configuration payload:\n{:#?}",
cfs_configuration
);

// Update/PUT CFS configuration
let cfs_configuration_resp = cfs::configuration::mesa::http_client::put(
shasta_token,
Expand All @@ -458,11 +456,6 @@ pub async fn check_nodes_are_ready_to_run_cfs_configuration_and_run_cfs_session(
)
.await;

log::info!(
"Create CFS configuration response:\n{:#?}",
cfs_configuration_resp
);

let cfs_configuration_name = match cfs_configuration_resp {
Ok(_) => &cfs_configuration_resp.as_ref().unwrap().name,
Err(e) => {
Expand Down Expand Up @@ -494,8 +487,6 @@ pub async fn check_nodes_are_ready_to_run_cfs_configuration_and_run_cfs_session(
None,
);

log::info!("Create CFS Session payload:\n{:#?}", session);

let cfs_session_resp = mesa::cfs::session::mesa::http_client::post(
shasta_token,
shasta_base_url,
Expand All @@ -504,8 +495,6 @@ pub async fn check_nodes_are_ready_to_run_cfs_configuration_and_run_cfs_session(
)
.await;

log::debug!("Create CFS Session response:\n{:#?}", cfs_session_resp);

let cfs_session_name = match cfs_session_resp {
Ok(_) => cfs_session_resp.as_ref().unwrap().name.as_ref().unwrap(),
Err(e) => {
Expand Down
4 changes: 2 additions & 2 deletions src/cli/commands/delete_sessions/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ fn test_is_cfs_configuration_used_to_build_image_true() {
let target = Target {
definition: Some("image".to_string()),
groups: None,
image_map: None,
image_map: Some(Vec::new()),
};

let cfs_session = CfsSessionGetResponse {
Expand Down Expand Up @@ -246,7 +246,7 @@ fn test_is_cfs_configuration_used_to_build_image_false_2() {
let target = Target {
definition: Some("dynamic".to_string()),
groups: None,
image_map: None,
image_map: Some(Vec::new()),
};

let cfs_session = CfsSessionGetResponse {
Expand Down

0 comments on commit 88bea67

Please sign in to comment.