Users forget `--execute` in the offset reset tool
Add a small warning note when the user does not use the --execute flag.
@@ -1033,16 +1033,16 @@ object ConsumerGroupCommand extends Logging {
CommandLineUtils.printUsageAndDie(parser, s"Option $deleteOpt either takes $groupOpt, $topicOpt, or both")
if (options.has(resetOffsetsOpt)) {
- if (!options.has(dryRunOpt) && !options.has(executeOpt)) {
- Console.err.println("WARN: In a future major release, the default behavior of this command will be to " +
- "prompt the user before executing the reset rather than doing a dry run. You should add the --dry-run " +
- "option explicitly if you are scripting this command and want to keep the current default behavior " +
- "without prompting.")
- }
-
if (options.has(dryRunOpt) && options.has(executeOpt))
CommandLineUtils.printUsageAndDie(parser, s"Option $resetOffsetsOpt only accepts one of $executeOpt and $dryRunOpt")
+ if (!options.has(dryRunOpt) && !options.has(executeOpt)) {
+ Console.err.println("WARN: No action will be performed as the --execute option is missing." +
+ "In a future major release, the default behavior of this command will be to prompt the user before " +
+ "executing the reset rather than doing a dry run. You should add the --dry-run option explicitly " +
+ "if you are scripting this command and want to keep the current default behavior without prompting.")
+ }
+
CommandLineUtils.checkRequiredArgs(parser, options, groupOpt)
CommandLineUtils.checkInvalidArgs(parser, options, resetToOffsetOpt, allResetOffsetScenarioOpts - resetToOffsetOpt)
CommandLineUtils.checkInvalidArgs(parser, options, resetToDatetimeOpt, allResetOffsetScenarioOpts - resetToDatetimeOpt)
