Use ipaddress module
This patch replaces use of ipaddr python module with ipaddress module. The ipaddr has been superseded by the ipaddress module. Also install python-ipaddress instead of python-ipaddr in deployed-server bootstrap scripts. Closes-Bug: #1751934 Change-Id: I63ae89869c8994e17b3460f9ae94e5fa922f6237
This commit is contained in:
parent
e0f59eefd2
commit
d0a03972a6
@ -4,7 +4,7 @@ set -eux
|
||||
|
||||
yum install -y \
|
||||
jq \
|
||||
python-ipaddr \
|
||||
python-ipaddress \
|
||||
puppet-tripleo \
|
||||
os-net-config \
|
||||
openvswitch \
|
||||
|
@ -4,7 +4,7 @@ set -eux
|
||||
|
||||
yum install -y \
|
||||
jq \
|
||||
python-ipaddr \
|
||||
python-ipaddress \
|
||||
puppet-tripleo\
|
||||
os-net-config \
|
||||
openvswitch \
|
||||
|
@ -33,7 +33,7 @@ function ping_controller_ips() {
|
||||
networks=$(ip r | grep -v default | cut -d " " -f 1)
|
||||
fi
|
||||
for LOCAL_NETWORK in $networks; do
|
||||
in_network=$(python -c "import ipaddr; net=ipaddr.IPNetwork('$LOCAL_NETWORK'); addr=ipaddr.IPAddress('$REMOTE_IP'); print(addr in net)")
|
||||
in_network=$(python -c "import ipaddress; net=ipaddress.ip_network(unicode('$LOCAL_NETWORK')); addr=ipaddress.ip_address(unicode('$REMOTE_IP')); print(addr in net)")
|
||||
if [[ $in_network == "True" ]]; then
|
||||
echo "Trying to ping $REMOTE_IP for local network ${LOCAL_NETWORK}."
|
||||
set +e
|
||||
|
Loading…
Reference in New Issue
Block a user