X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fjenkins-verify-images.sh;h=d005c52f0873b1c16ed408af3b1daaacf3944b97;hb=b55451a53da28d40c62de5cae462302a32fe4c31;hp=c97f06305a1bc4f0fb6b35ee4812d04b4030241e;hpb=28ea3ab0bd1aca3d00cf5428bd805481e137f0c8;p=releng%2Fglobal-jjb.git diff --git a/shell/jenkins-verify-images.sh b/shell/jenkins-verify-images.sh index c97f0630..d005c52f 100755 --- a/shell/jenkins-verify-images.sh +++ b/shell/jenkins-verify-images.sh @@ -16,21 +16,39 @@ set -eux -o pipefail error=false -for file in jenkins-config/clouds/openstack/*/*; do - # Set the $IMAGE_NAME variable to the the file's IMAGE_NAME value - export "$(grep ^IMAGE_NAME= $file)" - # The image should be listed as active +verify_images() +{ + echo "Verifying images on $1" + for file in "$1"/*; do + # Set the $IMAGE_NAME variable to the the file's IMAGE_NAME value + export "$(grep ^IMAGE_NAME= "$file")" + # The image should be listed as active - if ! openstack image list --property name="$IMAGE_NAME" | grep "active"; then - echo "ERROR: No matching image found for $IMAGE_NAME" - error=true - fi - # Set the $HARDWARE_ID variable to the the file's HARDWARE_ID value - export "$(grep ^HARDWARE_ID= $file)" - # The flavor should be listed. Spaces in grep string ensure complete match. + if ! openstack image list --property name="$IMAGE_NAME" | grep "active"; then + echo "ERROR: No matching image found for $IMAGE_NAME" + error=true + fi + # Set the $HARDWARE_ID variable to the the file's HARDWARE_ID value + export "$(grep ^HARDWARE_ID= "$file")" + # The flavor should be listed. Spaces in grep string ensure complete match. + + if ! openstack flavor list | grep " $HARDWARE_ID "; then + echo "ERROR: No matching flavor found for $HARDWARE_ID" + error=true + fi + done +} - if ! openstack flavor list | grep " $HARDWARE_ID "; then - echo "ERROR: No matching flavor found for $HARDWARE_ID" +echo "Verifying that cloud has a master configuration file" +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