- [ "$NUM_OPENSTACK_SITES" ] || NUM_OPENSTACK_SITES=1
- NUM_ODLS_PER_SITE=$((NUM_ODL_SYSTEM / NUM_OPENSTACK_SITES))
- for i in `seq 1 ${NUM_OPENSTACK_SITES}`; do
- for j in `seq 1 ${NUM_ODLS_PER_SITE}`; do
- odl_ip=ODL_SYSTEM_$(((i - 1) * NUM_ODLS_PER_SITE + j))_IP
- echo "Copying common-functions.sh to ${!odl_ip}:/tmp"
- scp /tmp/common-functions.sh ${!odl_ip}:/tmp
- done
+ mapfile -t ips <<< "$(openstack stack show -f json -c outputs "$STACK_NAME" | jq -r '.outputs[] | select(.output_key | match("^vm_[0-9]+_ips$")) | .output_value | .[]')"
+ for ip in "${ips[@]}"; do
+ echo "Copying common-functions.sh to ${ip}:/tmp"
+ scp /tmp/common-functions.sh "${ip}:/tmp"