Skip to content

Commit

Permalink
ZOOKEEPER-3876: zkServer.sh status command fails when IPV6 is configured
Browse files Browse the repository at this point in the history
Modified host and IP parsing logic for IPV6

Author: Mohammad Arshad <arshad@apache.org>

Reviewers: Enrico Olivelli <eolivelli@apache.org>

Closes apache#1395 from arshadmohammad/ZOOKEEPER-3876
  • Loading branch information
arshadmohammad authored and eolivelli committed Jul 29, 2020
1 parent 8a72a6e commit c9f1521
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bin/zkServer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,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
Expand Down

0 comments on commit c9f1521

Please sign in to comment.