scylla-nodetool: check for missing keyspace argument on describering

Calling scylla-nodetool with option describering and ommiting the keyspace
name argument results in a boost exception with the following error message:

error running operation: boost::wrapexcept<boost::bad_any_cast> (boost::bad_any_cast: failed conversion using boost::any_cast)

This change checks for the missing keyspace and outputs a more sensible
error message:

error processing arguments: keyspace must be specified

Closes scylladb/scylladb#17741
This commit is contained in:
Ferenc Szili
2024-03-11 18:33:35 +01:00
committed by Avi Kivity
parent f410038296
commit 1da5b3033e

View File

@@ -534,6 +534,10 @@ void decommission_operation(scylla_rest_client& client, const bpo::variables_map
}
void describering_operation(scylla_rest_client& client, const bpo::variables_map& vm) {
if (!vm.contains("keyspace")) {
throw std::invalid_argument("keyspace must be specified");
}
const auto keyspace = vm["keyspace"].as<sstring>();
const auto schema_version_res = client.get("/storage_service/schema_version");