Add sonar-prescan-script jobs for maven
[releng/global-jjb.git] / shell / jenkins-verify-images.sh
index e4e9e70..663dfb6 100755 (executable)
@@ -39,21 +39,21 @@ verify_images()
   done
 }
 
-for cloud in jenkins-config/clouds/openstack/*; do
-  echo "Verifying that cloud has a master configuration file"
-  # Verify that we have a cloud config file
-  if [ -f "$cloud/cloud.cfg" ]; then
-    # Get the OS_CLOUD variable from cloud config and export it
-    os_cloud=$(grep ^OS_CLOUD= "$cloud/cloud.cfg" | cut -d'=' -f2)
-    OS_CLOUD="${os_cloud:-vex}"
-    export OS_CLOUD
-
-    verify_images "$cloud"
-  else
-    echo "ERROR: No cloud.cfg for $cloud"
-    error=true
-  fi
-done
+echo "Verifying that cloud has a master configuration file"
+if [[ -d jenkins-config/clouds/openstack ]]; then
+  for cloud in jenkins-config/clouds/openstack/*; do
+    if [[ -f $cloud/cloud.cfg ]]; then
+      # Get the OS_CLOUD variable from cloud config
+      if ! os_cloud=$(grep -E "^OS_CLOUD=" "$cloud/cloud.cfg" | cut -d'=' -f2); then
+        os_cloud="vex"
+      fi
+      OS_CLOUD=$os_cloud verify_images "$cloud"
+    else
+      echo "ERROR: No cloud.cfg for $cloud"
+      error=true
+    fi
+  done
+fi
 
 if $error; then
   exit 1