Elukey has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368199 )

Change subject: confluent::kafka.sh: fix kafka-acls command autocompletion
......................................................................

confluent::kafka.sh: fix kafka-acls command autocompletion

Bug: T167304
Change-Id: I24f0cd766c688fcbb66097be9f5d229e6f80656b
---
M modules/confluent/files/kafka/kafka.sh
1 file changed, 13 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/99/368199/1

diff --git a/modules/confluent/files/kafka/kafka.sh 
b/modules/confluent/files/kafka/kafka.sh
index 96b570a..8d42124 100755
--- a/modules/confluent/files/kafka/kafka.sh
+++ b/modules/confluent/files/kafka/kafka.sh
@@ -27,6 +27,8 @@
                             flag will be given this value.
   KAFKA_BOOTSTRAP_SERVERS - If this is set, any commands that take a 
--broker-list or
                             --bootstrap-server flag will be given this value.
+  ZOOKEEPER_URL           - If this is set, any command that take a 
--authorized-property
+                            will get the correct zookeeper.connect value.
 
 "
 
@@ -68,6 +70,13 @@
     BOOTSTRAP_SERVER_OPT="--bootstrap-server ${KAFKA_BOOTSTRAP_SERVERS}"
 fi
 
+# Set ZOOKEEPER_CONNECT_OPT if ZOOKEEPER_URL is set and '--authorized-property 
zookeeper.connect'
+# has not also been passed in as a CLI arg.  This will be included
+# in command functions that take '--authorized-property zookeeper.connect' 
argument.
+if [ -n "${ZOOKEEPER_URL}" -a -z "$(echo $@ | egrep -- '--authorized-property\ 
*zookeeper\.connect')" ]; then
+    ZOOKEEPER_CONNECT_OPT="--authorized-property 
zookeeper.connect=${ZOOKEEPER_URL}"
+fi
+
 # Each of these lists signifies that either --broker-list, --bootstrap-server,
 # or --zookeeper needs to be given to the $command.  If $command matches one 
of these,
 # then we will add the opt if it is not provided already in $@.
@@ -87,18 +96,20 @@
 "kafka-broker-api-versions "\
 "kafka-consumer-groups "
 
-zookeeper_commands="kafka-acls "\
-"kafka-configs "\
+zookeeper_commands="kafka-configs "\
 "kafka-consumer-offset-checker.sh "\
 "kafka-preferred-replica-election "\
 "kafka-reassign-partitions "\
 "kafka-replay-log-producer "\
 "kafka-topics"
 
+zookeeper_connect_commands="kafka-acls"
+
 EXTRA_OPTS=""
 echo "${broker_list_commands}" | /bin/grep -q "${command}" && 
EXTRA_OPTS="${BROKER_LIST_OPT} "
 echo "${bootstrap_server_commands}" | /bin/grep -q "${command}" && 
EXTRA_OPTS="${EXTRA_OPTS}${BOOTSTRAP_SERVER_OPT} "
 echo "${zookeeper_commands}" | /bin/grep -q "${command}" && 
EXTRA_OPTS="${EXTRA_OPTS}${ZOOKEEPER_OPT} "
+echo "${zookeeper_connect_commands}" | /bin/grep -q "${command}" && 
EXTRA_OPTS="${EXTRA_OPTS}${ZOOKEEPER_CONNECT_OPT} "
 
 # Print out the command we are about to exec, and then run it
 echo "${command} ${EXTRA_OPTS}$@"

-- 
To view, visit https://gerrit.wikimedia.org/r/368199
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I24f0cd766c688fcbb66097be9f5d229e6f80656b
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Elukey <ltosc...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to