X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fjenkins-verify-images.sh;h=483a51b712729e096256639caae0d2c5a3d9f321;hb=refs%2Ftags%2Fv0.74.0;hp=a27efd83946aa8c8420322f2c3740d94bce6c340;hpb=4a05e8547f5175aeca9c4b78081c84dbf58de186;p=releng%2Fglobal-jjb.git diff --git a/shell/jenkins-verify-images.sh b/shell/jenkins-verify-images.sh index a27efd83..483a51b7 100755 --- a/shell/jenkins-verify-images.sh +++ b/shell/jenkins-verify-images.sh @@ -18,41 +18,43 @@ error=false 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 + 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" + error=true + fi + done } 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=$(egrep "^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 +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 + exit 1 fi