Browse Source

MINOR: Check invalid bootstrap-server, alter option and config flags before checking for the required --partitions flag (#6786)

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>
pull/6838/head
Stanislav Kozlovski 6 years ago committed by Manikumar Reddy
parent
commit
efeefa5d18
  1. 5
      core/src/main/scala/kafka/admin/TopicCommand.scala

5
core/src/main/scala/kafka/admin/TopicCommand.scala

@ -635,12 +635,13 @@ object TopicCommand extends Logging {
CommandLineUtils.checkRequiredArgs(parser, options, topicOpt) CommandLineUtils.checkRequiredArgs(parser, options, topicOpt)
if (has(createOpt) && !has(replicaAssignmentOpt)) if (has(createOpt) && !has(replicaAssignmentOpt))
CommandLineUtils.checkRequiredArgs(parser, options, partitionsOpt, replicationFactorOpt) CommandLineUtils.checkRequiredArgs(parser, options, partitionsOpt, replicationFactorOpt)
if (has(bootstrapServerOpt) && has(alterOpt)) if (has(bootstrapServerOpt) && has(alterOpt)) {
CommandLineUtils.checkInvalidArgsSet(parser, options, Set(bootstrapServerOpt, configOpt), Set(alterOpt))
CommandLineUtils.checkRequiredArgs(parser, options, partitionsOpt) CommandLineUtils.checkRequiredArgs(parser, options, partitionsOpt)
}
// check invalid args // check invalid args
CommandLineUtils.checkInvalidArgs(parser, options, configOpt, allTopicLevelOpts -- Set(alterOpt, createOpt)) CommandLineUtils.checkInvalidArgs(parser, options, configOpt, allTopicLevelOpts -- Set(alterOpt, createOpt))
CommandLineUtils.checkInvalidArgsSet(parser, options, Set(bootstrapServerOpt, configOpt), Set(alterOpt))
CommandLineUtils.checkInvalidArgs(parser, options, deleteConfigOpt, allTopicLevelOpts -- Set(alterOpt) ++ Set(bootstrapServerOpt)) CommandLineUtils.checkInvalidArgs(parser, options, deleteConfigOpt, allTopicLevelOpts -- Set(alterOpt) ++ Set(bootstrapServerOpt))
CommandLineUtils.checkInvalidArgs(parser, options, partitionsOpt, allTopicLevelOpts -- Set(alterOpt, createOpt)) CommandLineUtils.checkInvalidArgs(parser, options, partitionsOpt, allTopicLevelOpts -- Set(alterOpt, createOpt))
CommandLineUtils.checkInvalidArgs(parser, options, replicationFactorOpt, allTopicLevelOpts -- Set(createOpt)) CommandLineUtils.checkInvalidArgs(parser, options, replicationFactorOpt, allTopicLevelOpts -- Set(createOpt))

Loading…
Cancel
Save