X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fopendaylight-infra-copy-ssh-keys.sh;h=cce9296371d1d054be7425e656f7d0a872b3902a;hb=d190af926c7c0ef098c635fdae5b62350babffcc;hp=7bce8adcad321d4685e8c77842e2fbb93eda425b;hpb=1ede29b30b3245ddce06b2e49839f7b0da83be4b;p=releng%2Fbuilder.git diff --git a/jjb/opendaylight-infra-copy-ssh-keys.sh b/jjb/opendaylight-infra-copy-ssh-keys.sh index 7bce8adca..cce929637 100644 --- a/jjb/opendaylight-infra-copy-ssh-keys.sh +++ b/jjb/opendaylight-infra-copy-ssh-keys.sh @@ -1,14 +1,24 @@ #!/bin/bash +# SPDX-License-Identifier: EPL-1.0 +############################################################################## +# Copyright (c) 2017 The Linux Foundation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +############################################################################## + echo "----------> Copy ssh public keys to csit lab" -# shellcheck disable=SC1090 -source "$WORKSPACE/.venv-openstack/bin/activate" +# shellcheck source=/tmp/v/openstack/bin/activate disable=SC1091 +source "/tmp/v/openstack/bin/activate" function copy-ssh-keys-to-slave() { RETRIES=60 for j in $(seq 1 $RETRIES); do - # shellcheck disable=SC2046 - if [ $(ssh-copy-id -i /home/jenkins/.ssh/id_rsa.pub "jenkins@${i}" > /dev/null 2>&1) -eq 0 ]; then + # shellcheck disable=SC2006,SC2092 + if `ssh-copy-id -i /home/jenkins/.ssh/id_rsa.pub "jenkins@${i}" > /dev/null 2>&1`; then ssh "jenkins@${i}" 'echo "$(facter ipaddress_eth0) $(/bin/hostname)" | sudo tee -a /etc/hosts' echo "Successfully copied public keys to slave ${i}" break @@ -31,12 +41,12 @@ function copy-ssh-keys-to-slave() { # Print the Stack outputs parameters so that we can identify which IPs belong # to which VM types. -openstack --os-cloud rackspace stack show -c outputs "$STACK_NAME" +openstack stack show -c outputs "$STACK_NAME" -# shellcheck disable=SC2006 -ADDR=(`openstack --os-cloud rackspace stack show -f json -c outputs "$STACK_NAME" | \ - jq -r '.outputs[] | - select(.output_key | match("^vm_[0-9]+_ips\$")) | +# shellcheck disable=SC2006,SC2207 +ADDR=(`openstack stack show -f json -c outputs "$STACK_NAME" | \ + jq -r '.outputs[] | \ + select(.output_key | match("^vm_[0-9]+_ips\$")) | \ .output_value | .[]'`) pids="" for i in "${ADDR[@]}"; do