-for index in "${!TEST_GROUPS[@]}"; do
- VIRL_SERVER[${index}]=""
- while [[ ! "${VIRL_SERVER[${index}]}" ]]; do
- num_hosts=${#VIRL_SERVERS[@]}
- if [ $num_hosts == 0 ]
- then
- echo "No more VIRL candidate hosts available, failing."
- exit 127
- fi
- element=$[ $RANDOM % $num_hosts ]
- virl_server_candidate=${VIRL_SERVERS[$element]}
- virl_server_status=$(ssh ${SSH_OPTIONS} ${VIRL_USERNAME}@${virl_server_candidate} cat $VIRL_SERVER_STATUS_FILE 2>&1)
- echo VIRL HOST $virl_server_candidate status is \"$virl_server_status\"
- if [ "$virl_server_status" == "$VIRL_SERVER_EXPECTED_STATUS" ]
- then
- # Candidate is in good status. Select this server.
- VIRL_SERVER[${index}]="$virl_server_candidate"
- else
- # Candidate is in bad status. Remove from array.
- VIRL_SERVERS=("${VIRL_SERVERS[@]:0:$element}" "${VIRL_SERVERS[@]:$[$element+1]}")
- fi
- done
+VIRL_PROD_SERVERS=()
+for index in "${!VIRL_SERVERS[@]}"; do
+ virl_server_status=$(ssh ${SSH_OPTIONS} ${VIRL_USERNAME}@${VIRL_SERVERS[$index]} cat $VIRL_SERVER_STATUS_FILE 2>&1)
+ echo VIRL HOST ${VIRL_SERVERS[$index]} status is \"$virl_server_status\"
+ if [ "$virl_server_status" == "$VIRL_SERVER_EXPECTED_STATUS" ]
+ then
+ # Candidate is in good status. Add to array.
+ VIRL_PROD_SERVERS+=(${VIRL_SERVERS[$index]})
+ fi