X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fintegration%2Fcopy-common-functions.sh;h=c8835aad2bbcf5a509b2b79962ac5f68040c48a3;hb=0bbaed52afe35c97fb43c5fec376b3c03d19adf3;hp=4572ee1b2c552c50e681711bac1267478db45bd8;hpb=0b55e3bbd76ebac846187addc0140e7293b78d6c;p=releng%2Fbuilder.git diff --git a/jjb/integration/copy-common-functions.sh b/jjb/integration/copy-common-functions.sh index 4572ee1b2..c8835aad2 100644 --- a/jjb/integration/copy-common-functions.sh +++ b/jjb/integration/copy-common-functions.sh @@ -1,25 +1,20 @@ -#!/bin/bash +#!/bin/bash -l # Copy the whole script to /tmp/common-functions.sh and to remote nodes but # only if this script itself is executing and not sourced. jenkins prepends this # script to the common-functions.sh script when adding it to the robot minion. -# jenkins with then execute the script. The if check below checks that the +# jenkins will then execute the script. The if check below checks that the # script is executing rather than being sourced. When executed the condition # is true and copies the script. In the false path this copy below is skipped -# and the common-function.sh ends up sourced. +# and the sourcing continues so that the appended common-function.sh ends up sourced. if [ "${BASH_SOURCE[0]}" == "${0}" ]; then echo "Copying common-functions.sh to /tmp" cp "${0}" /tmp/common-functions.sh - [ "$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 done - # TODO: add copy to openstack systems when needed exit 0 fi