Make sure that jjb-cleanup.sh allows unbound vars
[releng/global-jjb.git] / shell / jenkins-configure-clouds.sh
index 3b8312e..df1b598 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -l
 # SPDX-License-Identifier: EPL-1.0
 ##############################################################################
 # Copyright (c) 2018 The Linux Foundation and others.
@@ -36,9 +36,6 @@ if [ ! -d "$WORKSPACE/jenkins-config/clouds" ]; then
     exit 0
 fi
 
-#shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
-source "/tmp/v/lftools/bin/activate"
-
 GROOVY_SCRIPT_FILE="jjb/global-jjb/jenkins-admin/manage_clouds.groovy"
 OS_CLOUD_DIR="$WORKSPACE/jenkins-config/clouds/openstack"
 SCRIPT_DIR="$WORKSPACE/archives/groovy-inserts"
@@ -166,7 +163,9 @@ get_minion_options() {
     volume_size=$(get_cfg "$cfg_file" VOLUME_SIZE "")
     hardware_id=$(get_cfg "$cfg_file" HARDWARE_ID "")
     network_id=$(get_cfg "$cfg_file" NETWORK_ID "")
-    user_data_id=$(get_cfg "$cfg_file" USER_DATA_ID "jenkins-init-script")
+
+    udi_default="$(get_cfg "$(dirname $cfg_file)/cloud.cfg" USER_DATA_ID "jenkins-init-script")"
+    user_data_id=$(get_cfg "$cfg_file" USER_DATA_ID "$udi_default")
 
     # Handle Sandbox systems that might have a different cap.
     instance_cap=$(get_cfg "$cfg_file" INSTANCE_CAP "null")
@@ -179,7 +178,10 @@ get_minion_options() {
     security_groups=$(get_cfg "$cfg_file" SECURITY_GROUPS "default")
     availability_zone=$(get_cfg "$cfg_file" AVAILABILITY_ZONE "")
     start_timeout=$(get_cfg "$cfg_file" START_TIMEOUT "600000")
-    key_pair_name=$(get_cfg "$cfg_file" KEY_PAIR_NAME "jenkins-ssh")
+
+    kpn_default="$(get_cfg "$(dirname $cfg_file)/cloud.cfg" KEY_PAIR_NAME "jenkins-ssh")"
+    key_pair_name=$(get_cfg "$cfg_file" KEY_PAIR_NAME "$kpn_default")
+
     num_executors=$(get_cfg "$cfg_file" NUM_EXECUTORS "1")
     jvm_options=$(get_cfg "$cfg_file" JVM_OPTIONS "")
     fs_root=$(get_cfg "$cfg_file" FS_ROOT "/w")