showuon commented on a change in pull request #10811:
URL: https://github.com/apache/kafka/pull/10811#discussion_r662866236



##########
File path: core/src/main/scala/kafka/admin/ConfigCommand.scala
##########
@@ -132,17 +122,22 @@ object ConfigCommand extends Config {
     val entity = parseEntity(opts)
     val entityType = entity.root.entityType
     val entityName = entity.fullSanitizedName
-
-    if (entityType == ConfigType.User)
+    val errorMessage = s"--bootstrap-server option must be specified to update 
$entityType configs $configsToBeAdded $configsToBeDeleted."
+
+    if (entityType == ConfigType.User) {
+      if (!configsToBeAdded.isEmpty || !configsToBeDeleted.isEmpty) {
+        val info = "User configuration updates using ZooKeeper are only 
supported for SCRAM credential updates."
+        // make sure every added/deleted configs are SCRAM related, other 
configs are not supported using zookeeper
+        require(configsToBeAdded.keys().asScala.forall(propertyKey => 
ScramMechanism.values().map(_.mechanismName()).contains(propertyKey.toString)),
+          s"$errorMessage $info")
+        require(configsToBeDeleted.forall(propertyKey => 
ScramMechanism.values().map(_.mechanismName()).contains(propertyKey)),
+          s"$errorMessage $info")

Review comment:
       Add a `user` type check to only allow SCRAM credential updates.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to