CASSANDRA-20876: Offline nodetool commands should not print network options in help#4871
CASSANDRA-20876: Offline nodetool commands should not print network options in help#4871arvindKandpal-ksolves wants to merge 1 commit into
Conversation
bae5010 to
f8e36d9
Compare
|
Thanks for the feedback @Mmuzaf! You're completely right about the potential side effects of calling Let me know if this looks good! |
|
@arvindKandpal-ksolves , please also add a test to ensure that none of the commands which implement |
…ptions in help - Introduced LocalCommand marker interface to identify commands that execute purely locally without a JMX connection. - Updated History command to implement LocalCommand. - Updated CassandraCliHelpLayout to check for LocalCommand instead of calling execution-flow methods, safely suppressing JMX options for offline commands.
f8e36d9 to
dfe6476
Compare
|
Thanks for the feedback @Mmuzaf! Added the test testLocalCommandsShouldNotConnect in NodetoolClassHierarchyTest Both HistoryTest and NodetoolClassHierarchyTest pass successfully. |
Summary
Offline nodetool commands (e.g.
history) do not require a JMX connection,yet their
--helpoutput was showing network-related options like--host,--port,--password, etc. This is misleading and unnecessary.Changes
AbstractCommand.java: Added a publicisOfflineCommand()method thatsafely wraps the existing
protected shouldConnect()to expose whether acommand requires a JMX connection.
CassandraCliHelpLayout.java: UpdatedparentCommandOptionsWithJmxOptions()to suppress
JmxConnectoptions from help output when the command is offline.NodetoolCommandoptions are still always shown for backwards compatibility.test/resources/nodetool/help/history: Updated help snapshot to reflectthe corrected output — JMX network options are no longer shown for
history.patch by Arvind Kandpal; reviewed by TBD for CASSANDRA-20876