X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fjenkins-verify-images.sh;h=f05e3c35b0a2d30a2da1f3ff5dce3d46ef5ed076;hb=fe2beb15bc9effb5b91ba17b520ab6c167dd6604;hp=754532322c509edfcda0e27710d60e61f436eea5;hpb=b0f1970ac95d59eef51a0091f0660b8ea2bacbe9;p=releng%2Fglobal-jjb.git diff --git a/shell/jenkins-verify-images.sh b/shell/jenkins-verify-images.sh index 75453232..f05e3c35 100755 --- a/shell/jenkins-verify-images.sh +++ b/shell/jenkins-verify-images.sh @@ -16,21 +16,40 @@ 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 +} + +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 ^CLOUD_CREDENTIAL_ID= "$cloud/cloud.cfg" | cut -d'=' -f2) + export OS_CLOUD - if ! openstack flavor list | grep " $HARDWARE_ID "; then - echo "ERROR: No matching flavor found for $HARDWARE_ID" + verify_images "$cloud" + else + echo "ERROR: No cloud.cfg for $cloud" error=true fi done