Skip to content

Commit

Permalink
fix for no longer using cf ic inspect images
Browse files Browse the repository at this point in the history
  • Loading branch information
jgarcows committed May 24, 2016
1 parent 3e7e83d commit ec3349d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions image_utilities.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,24 @@ if [ -z $IMAGE_LIMIT ]; then
IMAGE_LIMIT=5
fi
if [ $IMAGE_LIMIT -gt 0 ]; then
ice_retry_save_output inspect images 2> /dev/null
ice_retry_save_output images 2> /dev/null
RESULT=$?
if [ $RESULT -eq 0 ]; then
# find the number of images and check if greater than or equal to image limit
NUMBER_IMAGES=$(grep "${REGISTRY_URL}/${IMAGE_NAME}:[0-9]\+" iceretry.log | grep \"Image\": | wc -l)
NUMBER_IMAGES=$(grep "${REGISTRY_URL}/${IMAGE_NAME}:[0-9]\+" iceretry.log | wc -l)
_USE_CF_PROCESSING=0
if [ $NUMBER_IMAGES -eq 0 ]; then
NUMBER_IMAGES=$(grep "${REGISTRY_URL}/${IMAGE_NAME}\s\+[0-9]\+" iceretry.log | wc -l)
_USE_CF_PROCESSING=1
fi
log_and_echo "Number of images: $NUMBER_IMAGES and Image limit: $IMAGE_LIMIT"
if [ $NUMBER_IMAGES -ge $IMAGE_LIMIT ]; then
# create array of images name
ICE_IMAGES_ARRAY=$(grep "${REGISTRY_URL}/${IMAGE_NAME}:[0-9]\+" iceretry.log | awk '/Image/ {printf "%s\n", $2}' | sed 's/"//'g | sed 's/,//'g)
if [ $_USE_CF_PROCESSING -eq 0 ]; then
ICE_IMAGES_ARRAY=$(grep -o "${REGISTRY_URL}/${IMAGE_NAME}:[0-9]\+" iceretry.log)
else
ICE_IMAGES_ARRAY=$(grep -o "${REGISTRY_URL}/${IMAGE_NAME}\s\+[0-9]\+" iceretry.log | awk '{print $1":"$2}')
fi
# loop the list of spaces under the org and find the name of the images that are in used
$CFCMD spaces > inspect.log 2> /dev/null
RESULT=$?
Expand Down

0 comments on commit ec3349d

Please sign in to comment.