You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by eo...@apache.org on 2020/07/29 10:32:10 UTC

[zookeeper] branch branch-3.6 updated: ZOOKEEPER-3876: zkServer.sh status command fails when IPV6 is configured

This is an automated email from the ASF dual-hosted git repository.

eolivelli pushed a commit to branch branch-3.6
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/branch-3.6 by this push:
     new f6b7b1b  ZOOKEEPER-3876: zkServer.sh status command fails when IPV6 is configured
f6b7b1b is described below

commit f6b7b1b35be13a2bb35f44f58773ba87f5b40b50
Author: Mohammad Arshad <ar...@apache.org>
AuthorDate: Wed Jul 29 12:31:40 2020 +0200

    ZOOKEEPER-3876: zkServer.sh status command fails when IPV6 is configured
    
    Modified host and IP parsing logic for IPV6
    
    Author: Mohammad Arshad <ar...@apache.org>
    
    Reviewers: Enrico Olivelli <eo...@apache.org>
    
    Closes #1395 from arshadmohammad/ZOOKEEPER-3876
    
    (cherry picked from commit c9f15213663fc9b86809adcbc27a4dbe1232c31a)
    Signed-off-by: Enrico Olivelli <eo...@apache.org>
---
 bin/zkServer.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/bin/zkServer.sh b/bin/zkServer.sh
index f3a8ba0..4780118 100755
--- a/bin/zkServer.sh
+++ b/bin/zkServer.sh
@@ -253,7 +253,12 @@ status)
           echo "Client port not found in the server configs"
         else
           if [[ "$clientPortAndAddress" =~ ^.*:[0-9]+ ]] ; then
-            clientPortAddress=`echo "$clientPortAndAddress" | sed -e 's/:.*//'`
+            if [[ "$clientPortAndAddress" =~ \[.*\]:[0-9]+ ]] ; then
+              # Extracts address from address:port for example extracts 127::1 from "[127::1]:2181"
+              clientPortAddress=`echo "$clientPortAndAddress" | sed -e 's|\[||' | sed -e 's|\]:.*||'`
+            else
+              clientPortAddress=`echo "$clientPortAndAddress" | sed -e 's/:.*//'`
+            fi
           fi
           clientPort=`echo "$clientPortAndAddress" | sed -e 's/.*://'`
         fi