Merge "Refactor job-groups documentation"
[releng/global-jjb.git] / shell / jenkins-configure-clouds.sh
index 0b30c59..456b825 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.
@@ -166,7 +166,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")
@@ -191,7 +193,8 @@ get_minion_options() {
     launcher_factory=$(get_launcher_factory "$connection_type")
 
     OS_PLUGIN_VER="$(lftools jenkins plugins list \
-        | grep -i 'OpenStack Cloud Plugin' | awk -F':' '{print $2}')"
+        | grep -i 'OpenStack Cloud Plugin' \
+        | awk -F':' '{print $2}' | awk -F' ' '{print $1}')"
     if version_ge "$OS_PLUGIN_VER" "2.35"; then
         if [ ! -z "$volume_size" ]; then
             echo "    new BootSource.VolumeFromImage(\"$image_name\", $volume_size),"