Skip to content

Commit

Permalink
fix: move deprecated messages in command get nodes to log when output…
Browse files Browse the repository at this point in the history
… is json
  • Loading branch information
Manuel Sopena Ballesteros committed Jul 12, 2024
1 parent 85d6cfb commit 278732f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish = false # cargo
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
mesa = "0.38.0"
mesa = "0.38.1"
# mesa = { path = "../mesa" } # Only for development purposes
strum = "0.25.0"
strum_macros = "0.25"
Expand Down
4 changes: 2 additions & 2 deletions src/cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ pub fn subcommand_get_cluster_details(hsm_group: Option<&String>) -> Command {
.arg(arg!(-n --"nids-only-one-line" "Prints nids in one line eg nidxxxxxx,nidyyyyyy,nidzzzzzz,..."))
.arg(arg!(-x --"xnames-only-one-line" "Prints xnames in one line eg x1001c1s5b0n0,x1001c1s5b0n1,..."))
.arg(arg!(-s --"status" "Get cluster status:\n - OK: All nodes are operational (booted and configured)\n - OFF: At least one node is OFF\n - ON: No nodes OFF and at least one is ON\n - STANDBY: At least one node's heartbeat is lost\n - UNCONFIGURED: All nodes are READY but at least one of them is being configured\n - FAILED: At least one node configuration failed"))
.arg(arg!(-o --output <FORMAT> "Output format. If missing it will print output data in human redeable (tabular) format").value_parser(["json", "summary"]));
.arg(arg!(-o --output <FORMAT> "Output format. If missing it will print output data in human readable (tabular) format").value_parser(["table", "json", "summary"]).default_value("table"));

match hsm_group {
None => {
Expand All @@ -376,7 +376,7 @@ pub fn subcommand_get_node(hsm_group: Option<&String>) -> Command {
.about("DEPRECATED - Please use 'manta get cluster' command instead.\nGet members of a HSM group")
.arg(arg!(-n --"nids-only-one-line" "Prints nids in one line eg nidxxxxxx,nidyyyyyy,nidzzzzzz,..."))
.arg(arg!(-x --"xnames-only-one-line" "Prints xnames in one line eg x1001c1s5b0n0,x1001c1s5b0n1,..."))
.arg(arg!(-o --output <FORMAT> "Output format. If missing it will print output data in human redeable (tabular) format").value_parser(["json"]));
.arg(arg!(-o --output <FORMAT> "Output format. If missing it will print output data in human readable (tabular) format").value_parser(["table", "json", "summary"]).default_value("table"));

match hsm_group {
None => {
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/get_hw_configuration_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub async fn exec(

// Get HW inventory details for target HSM group
for (i, hsm_member) in hsm_group_target_members.iter().enumerate() {
print!(
log::info!(
"\rGetting hw components for node '{hsm_member}' [{i:>width$}/{num_hsm_group_members}]"
);
io::stdout().flush().unwrap();
Expand Down
23 changes: 9 additions & 14 deletions src/cli/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -822,9 +822,6 @@ pub async fn process_cli(
)
.await;
} else if let Some(cli_get_node) = cli_get.subcommand_matches("nodes") {
println!("Deprecated - Please use 'manta get cluster' command instead.");
log::warn!("Deprecated - Please use 'manta get cluster' command instead.");

let hsm_group_name_arg_opt = cli_get_node.get_one::<String>("HSM_GROUP_NAME");

let target_hsm_group_vec = get_target_hsm_group_vec_or_all(
Expand All @@ -836,6 +833,14 @@ pub async fn process_cli(
)
.await;

let output_opt = cli_get_node.get_one::<String>("output");

if output_opt.is_some_and(|output| output == "table" || output == "summary") {
println!("Deprecated - Please use 'manta get cluster' command instead.");
} else {
log::warn!("Deprecated - Please use 'manta get cluster' command instead.");
}

get_nodes::exec(
shasta_token,
shasta_base_url,
Expand All @@ -847,12 +852,11 @@ pub async fn process_cli(
*cli_get_node
.get_one::<bool>("xnames-only-one-line")
.unwrap_or(&false),
cli_get_node.get_one::<String>("output"),
output_opt,
false,
)
.await;
} else if let Some(cli_get_hsm_groups) = cli_get.subcommand_matches("hsm-groups") {
println!("Deprecated - Do not use this command.");
log::warn!("Deprecated - Do not use this command.");

let hsm_group_name_arg_opt = cli_get_hsm_groups.get_one::<String>("HSM_GROUP_NAME");
Expand Down Expand Up @@ -968,7 +972,6 @@ pub async fn process_cli(
} else if let Some(cli_apply_configuration) =
cli_apply.subcommand_matches("configuration")
{
println!("Deprecated - Please use 'manta apply sat-file' command instead.");
log::warn!("Deprecated - Please use 'manta apply sat-file' command instead.");

get_target_hsm_group_vec_or_all(
Expand Down Expand Up @@ -1080,7 +1083,6 @@ pub async fn process_cli(
)
.await;
} else if let Some(cli_apply_image) = cli_apply.subcommand_matches("image") {
println!("Deprecated - Please use 'manta apply sat-file' command instead.");
log::warn!("Deprecated - Please use 'manta apply sat-file' command instead.");

get_target_hsm_group_vec_or_all(
Expand Down Expand Up @@ -1148,7 +1150,6 @@ pub async fn process_cli(
)
.await;
} else if let Some(cli_apply_cluster) = cli_apply.subcommand_matches("cluster") {
println!("Deprecated - Please use 'manta apply sat-file' command instead.");
log::warn!("Deprecated - Please use 'manta apply sat-file' command instead.");

let target_hsm_group_vec = get_target_hsm_group_vec_or_all(
Expand Down Expand Up @@ -1294,7 +1295,6 @@ pub async fn process_cli(
.await;
} else if let Some(cli_apply_node) = cli_apply.subcommand_matches("node") {
if let Some(cli_apply_node_on) = cli_apply_node.subcommand_matches("on") {
println!("Deprecated - Please use 'manta power on' command instead.");
log::warn!("Deprecated - Please use 'manta power on' command instead.");

/* apply_node_on::exec(
Expand Down Expand Up @@ -1336,7 +1336,6 @@ pub async fn process_cli(
)
.await;
} else if let Some(cli_apply_node_off) = cli_apply_node.subcommand_matches("off") {
println!("Deprecated - Please use 'manta power off' command instead.");
log::warn!("Deprecated - Please use 'manta power off' command instead.");

/* apply_node_off::exec(
Expand Down Expand Up @@ -1382,7 +1381,6 @@ pub async fn process_cli(
} else if let Some(cli_apply_node_reset) =
cli_apply_node.subcommand_matches("reset")
{
println!("Deprecated - Please use 'manta power reset' command instead.");
log::warn!("Deprecated - Please use 'manta power reset' command instead.");

/* apply_node_reset::exec(
Expand Down Expand Up @@ -1450,7 +1448,6 @@ pub async fn process_cli(
.await;
} else if let Some(cli_apply_boot) = cli_apply.subcommand_matches("boot") {
if let Some(cli_apply_boot_nodes) = cli_apply_boot.subcommand_matches("nodes") {
println!("Deprecated - Please use 'manta power' command instead.");
log::warn!("Deprecated - Please use 'manta power' command instead.");

let hsm_group_name_arg_opt =
Expand Down Expand Up @@ -1512,7 +1509,6 @@ pub async fn process_cli(
}
} else if let Some(cli_update) = cli_root.subcommand_matches("update") {
if let Some(cli_update_node) = cli_update.subcommand_matches("nodes") {
println!("Deprecated - Please use 'manta apply boot nodes' command instead.");
log::warn!("Deprecated - Please use 'manta apply boot nodes' command instead.");

let hsm_group_name_arg_opt = cli_update_node.get_one::<String>("HSM_GROUP_NAME");
Expand Down Expand Up @@ -1545,7 +1541,6 @@ pub async fn process_cli(
)
.await;
} else if let Some(cli_update_hsm_group) = cli_update.subcommand_matches("hsm-group") {
println!("Deprecated - Please use 'manta apply boot cluster' command instead.");
log::warn!("Deprecated - Please use 'manta apply boot cluster' command instead.");

let hsm_group_name_arg_opt =
Expand Down

0 comments on commit 278732f

Please sign in to comment.