Pull default KEY_PAIR_NAME from cloud.cfg 50/11750/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 12 Jul 2018 17:38:03 +0000 (13:38 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 12 Jul 2018 17:38:50 +0000 (13:38 -0400)
Sets the default KEY_PAIR_NAME for minion templates to be
what is defined in cloud.cfg. If cloud.cfg does not define
one then default to "jenkins-ssh".

Issue: RELENG-1066
Change-Id: I72bddf861174139048e1843a3631b3998ac32bef
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
shell/jenkins-configure-clouds.sh

index 3b8312e..0b30c59 100644 (file)
@@ -179,7 +179,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")