diff --git a/salt/common/tools/sbin/soup b/salt/common/tools/sbin/soup index 10d52fe59..3859ab3cd 100755 --- a/salt/common/tools/sbin/soup +++ b/salt/common/tools/sbin/soup @@ -38,7 +38,8 @@ manager_check() { clean_dockers() { # Place Holder for cleaning up old docker images - echo "" + echo "Trying to clean up old dockers." + docker system prune -a -f } clone_to_tmp() { @@ -185,6 +186,18 @@ rc2_to_rc3() { } +space_check() { + # Check to see if there is enough space + CURRENTSPACE=$(df -BG / | grep -v Avail | awk '{print $4}' | sed 's/.$//') + if [ "$CURRENTSPACE" -lt "10" ]; then + echo "You are low on disk space. Upgrade will try and clean up space."; + clean_dockers + else + echo "Plenty of space for upgrading" + fi + +} + update_dockers() { # List all the containers if [ $MANAGERCHECK == 'so-import' ]; then @@ -366,7 +379,7 @@ echo "" echo "Let's see if we need to update Security Onion." upgrade_check - +space_check echo "" echo "Performing upgrade from Security Onion $INSTALLEDVERSION to Security Onion $NEWVERSION." @@ -385,8 +398,6 @@ echo "Making pillar changes." pillar_changes echo "" -echo "Cleaning up old dockers." -clean_dockers echo "" echo "Updating dockers to $NEWVERSION." update_dockers