Chore: Upgrade Jenkins-job-builder to 6.3.0
[releng/global-jjb.git] / shell / openstack-stack-copy-ssh-keys.sh
index 463a386..f20e1d9 100644 (file)
@@ -13,7 +13,7 @@ echo "---> Copy SSH public keys to CSIT lab"
 os_cloud="${OS_CLOUD:-vex}"
 stack_name="${OS_STACK_NAME}"
 
-function copy_ssh_keys() {
+copy_ssh_keys () {
     if [ -z "$1" ]; then
         >&2 echo "ERROR: Missing required arguments."
         >&2 echo "Usage: copy_ssh_keys IP_ADDRESS"
@@ -50,12 +50,20 @@ function copy_ssh_keys() {
     done
 }
 
+# shellcheck disable=SC1090
+source ~/lf-env.sh
+
+lf-activate-venv --python python3 "lftools[openstack]" \
+    kubernetes \
+    python-heatclient \
+    python-openstackclient
+
 # IP Addresses are returned as a space separated list so word splitting is ok
 # shellcheck disable=SC2207
 ip_addresses=($(openstack --os-cloud "$os_cloud" stack show -f json -c outputs "$stack_name" |
-       jq -r '.outputs[] |
-              select(.output_key | match("^vm_[0-9]+_ips$")) |
-              .output_value | .[]'))
+        jq -r '.outputs[] |
+                select(.output_key | match("^vm_[0-9]+_ips$")) |
+                .output_value | .[]'))
 pids=""
 for ip in "${ip_addresses[@]}"; do
     ( copy_ssh_keys "$ip" ) &