Fix: pre-commit and tox issues
[releng/builder.git] / jjb / integration / integration-get-slave-addresses.sh
index 816dcf80a72515593df804d1510abcee0bdac5a8..80eabb6fd52742f8ebed84a57fe47e68c0707b91 100644 (file)
@@ -1,4 +1,13 @@
-#!/bin/bash
+#!/bin/bash -l
+
+# shellcheck disable=SC1090
+. ~/lf-env.sh
+
+lf-activate-venv --python python3 \
+    python-heatclient \
+    python-openstackclient \
+    yq
+
 # Get the Controller and Tools VM slave addresses
 
 set -x
@@ -7,11 +16,7 @@ ODL_SYSTEM=()
 TOOLS_SYSTEM=()
 OPENSTACK_SYSTEM=()
 OPENSTACK_CONTROLLERS=()
-[ "$NUM_OPENSTACK_SITES" ] || NUM_OPENSTACK_SITES=1
 
-OPENSTACK_VENV="/tmp/v/openstack"
-# shellcheck source=/tmp/v/openstack/bin/activate disable=SC1091
-source $OPENSTACK_VENV/bin/activate
 mapfile -t ADDR <<< "$(openstack stack show -f json -c outputs "$STACK_NAME" | jq -r '.outputs[] | select(.output_key | match("^vm_[0-9]+_ips$")) | .output_value | .[]')"
 
 # The next two blocks of code will parse the list of vm IP's hostnames to determine which type of node
@@ -54,7 +59,7 @@ echo "NUM_TOOLS_SYSTEM=${#TOOLS_SYSTEM[@]}" >> slave_addresses.txt
 #if HA Proxy is requested the last devstack node will be configured as haproxy
 if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
    # HA Proxy is installed on one OPENSTACK_SYSTEM VM on each site
-   NUM_OPENSTACK_SYSTEM=$(( ${#OPENSTACK_SYSTEM[@]} - NUM_OPENSTACK_SITES ))
+   NUM_OPENSTACK_SYSTEM=$(( ${#OPENSTACK_SYSTEM[@]} - 1 ))
 else
    NUM_OPENSTACK_SYSTEM=${#OPENSTACK_SYSTEM[@]}
 fi
@@ -72,7 +77,7 @@ if [ ${#OPENSTACK_CONTROLLERS[@]} -eq 2 ]; then
     ctrl_index=$((ctrl_index -1))
     tmp_addr=${OPENSTACK_SYSTEM[0]}
     OPENSTACK_SYSTEM[0]=${OPENSTACK_SYSTEM[$ctrl_index]}
-    OPENSTACK_SYSTEM[$ctrl_index]=$tmp_addr
+    OPENSTACK_SYSTEM[ctrl_index]=$tmp_addr
 fi
 
 # Add alias for ODL_SYSTEM_1_IP as ODL_SYSTEM_IP
@@ -91,7 +96,7 @@ done
 
 openstack_index=0
 # Assuming number of openstack control nodes equals number of openstack sites
-NUM_OPENSTACK_CONTROL_NODES=$(( NUM_OPENSTACK_SITES ))
+NUM_OPENSTACK_CONTROL_NODES=1
 echo "NUM_OPENSTACK_CONTROL_NODES=${NUM_OPENSTACK_CONTROL_NODES}" >> slave_addresses.txt
 for i in $(seq 0 $((NUM_OPENSTACK_CONTROL_NODES - 1)))
 do