Skip to content

Commit

Permalink
Show deprecation/pruning candidate total
Browse files Browse the repository at this point in the history
Previously, the image deprecation and pruning scripts showed the total
number of images on each system (GCE or EC2).  This is not a useful
count as it doesn't accurately reflect the backlog size of potential
deprecation/pruning images.  Fix this by operating on and showing
the total potential deprecation/pruning images in addition to the total.

Signed-off-by: Chris Evich <cevich@redhat.com>
  • Loading branch information
cevich committed Jul 5, 2024
1 parent a949291 commit 3252adb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion IMG_SFX
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20240705t154925z-f40f39d13
20240705t162054z-f40f39d13
7 changes: 4 additions & 3 deletions imgobsolete/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,15 @@ for (( i=nr_amis ; i ; i-- )); do
done

COUNT=$(<"$IMGCOUNT")
CANDIDATES=$(wc -l <$TOOBSOLETE)
msg "########################################################################"
msg "Obsoleting $OBSOLETE_LIMIT random images of $COUNT examined:"
msg "Obsoleting $OBSOLETE_LIMIT random image candidates ($CANDIDATES/$COUNT total):"

# Require a minimum number of images to exist. Also if there is some
# horrible scripting accident, this limits the blast-radius.
if [[ "$COUNT" -lt $OBSOLETE_LIMIT ]]
if [[ "$CANDIDATES" -lt $OBSOLETE_LIMIT ]]
then
die 0 "Safety-net Insufficient images ($COUNT) to process ($OBSOLETE_LIMIT required)"
die 0 "Safety-net Insufficient images ($CANDIDATES) to process ($OBSOLETE_LIMIT required)"
fi

# Don't let one bad apple ruin the whole bunch
Expand Down
7 changes: 4 additions & 3 deletions imgprune/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,14 @@ for (( i=nr_amis ; i ; i-- )); do
done

COUNT=$(<"$IMGCOUNT")
CANDIDATES=$(wc -l <$TODELETE)
msg "########################################################################"
msg "Deleting up to $DELETE_LIMIT random images of $COUNT examined:"
msg "Deleting up to $DELETE_LIMIT random image candidates ($CANDIDATES/$COUNT total)::"

# Require a minimum number of images to exist
if [[ "$COUNT" -lt $DELETE_LIMIT ]]
if [[ "$CANDIDATES" -lt $DELETE_LIMIT ]]
then
die 0 "Safety-net Insufficient images ($COUNT) to process deletions ($DELETE_LIMIT required)"
die 0 "Safety-net Insufficient images ($CANDIDATES) to process deletions ($DELETE_LIMIT required)"
fi

sort --random-sort $TODELETE | tail -$DELETE_LIMIT | \
Expand Down

0 comments on commit 3252adb

Please sign in to comment.