Browse Source

MINOR: Fix format of allowed operations in kafka-acls error message (#14395)

kafka-acls cli prints the following error message on invalid operation:

$ kafka-acls --bootstrap-server xxx:9095 --remove --allow-principal "User:abc" --allow-host * --operation DESCRIBE_CONFIGS --topic xyz
ResourceType TOPIC only supports operations WRITE,DESCRIBE,ALL,READ,CREATE,ALTER,DELETE,DESCRIBE_CONFIGS,ALTER_CONFIGS

The following command actually works:

$ kafka-acls --bootstrap-server xxx:9095 --remove --allow-principal "User:abc" --allow-host * --operation DescribeConfigs --topic xyz

This PR fixes the invalid formating of operations in the error message and adds a space after the comma.
pull/14403/head
Jouni Tenhunen 1 year ago committed by GitHub
parent
commit
073b9a2a1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      core/src/main/scala/kafka/admin/AclCommand.scala

2
core/src/main/scala/kafka/admin/AclCommand.scala

@ -487,7 +487,7 @@ object AclCommand extends Logging { @@ -487,7 +487,7 @@ object AclCommand extends Logging {
for ((resource, acls) <- resourceToAcls) {
val validOps = AclEntry.supportedOperations(resource.resourceType) + AclOperation.ALL
if ((acls.map(_.operation) -- validOps).nonEmpty)
CommandLineUtils.printUsageAndExit(opts.parser, s"ResourceType ${resource.resourceType} only supports operations ${validOps.mkString(",")}")
CommandLineUtils.printUsageAndExit(opts.parser, s"ResourceType ${resource.resourceType} only supports operations ${validOps.map(JSecurityUtils.operationName(_)).mkString(", ")}")
}
}

Loading…
Cancel
Save