X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=utils%2Ffetch_os_creds.sh;h=501095036c34082399aeb16bca5a27fac8232ac1;hb=28f7d7c0ef101a6660b743620e0f2d5aa3e8993e;hp=b40b75b75b2900117b45f95c6cac34aa9f907597;hpb=d2755cb7237222d0e6a0ebf88fcf2464c2708f86;p=releng.git diff --git a/utils/fetch_os_creds.sh b/utils/fetch_os_creds.sh index b40b75b75..501095036 100755 --- a/utils/fetch_os_creds.sh +++ b/utils/fetch_os_creds.sh @@ -8,7 +8,6 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## set -o errexit -set -o nounset set -o pipefail usage() { @@ -149,29 +148,33 @@ if [ "$installer_type" == "fuel" ]; then echo $auth_url >> $dest_path elif [ "$installer_type" == "apex" ]; then - if ! ipcalc -c $installer_ip; then - installer_ip=$(sudo virsh domifaddr undercloud | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}') - if [ -z "$installer_ip" ] || ! $(ipcalc -c $installer_ip); then - echo "Unable to find valid IP for Apex undercloud: ${installer_ip}" - exit 1 - fi - fi - verify_connectivity $installer_ip + if [ -n "$RC_FILE_PATH" ]; then + echo "RC_FILE_PATH is set: ${RC_FILE_PATH}. Copying RC FILE to ${dest_path}" + sudo cp -f ${RC_FILE_PATH} ${dest_path} + else + if ! ipcalc -c $installer_ip; then + installer_ip=$(sudo virsh domifaddr undercloud | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}') + if [ -z "$installer_ip" ] || ! $(ipcalc -c $installer_ip); then + echo "Unable to find valid IP for Apex undercloud: ${installer_ip}" + exit 1 + fi + fi + verify_connectivity $installer_ip - # The credentials file is located in the Instack VM (192.0.2.1) - # NOTE: This might change for bare metal deployments - info "... from Instack VM $installer_ip..." - if [ -f /root/.ssh/id_rsa ]; then - chmod 600 /root/.ssh/id_rsa - fi + # The credentials file is located in the Instack VM (192.0.2.1) + # NOTE: This might change for bare metal deployments + info "... from Instack VM $installer_ip..." + if [ -f /root/.ssh/id_rsa ]; then + chmod 600 /root/.ssh/id_rsa + fi - if [ "${BRANCH}" == "stable/fraser" ]; then - rc_file=overcloudrc.v3 - else - rc_file=overcloudrc + if [ "${BRANCH}" == "stable/fraser" ]; then + rc_file=overcloudrc.v3 + else + rc_file=overcloudrc + fi + sudo scp $ssh_options root@$installer_ip:/home/stack/${rc_file} $dest_path fi - sudo scp $ssh_options root@$installer_ip:/home/stack/${rc_file} $dest_path - elif [ "$installer_type" == "compass" ]; then if [ "${BRANCH}" == "stable/danube" ]; then verify_connectivity $installer_ip