soup upgrade salt on minions - add batch size option

This commit is contained in:
m0duspwnens
2020-07-29 14:18:11 -04:00
parent 0de6e86cdb
commit b8c0653818

View File

@@ -21,6 +21,7 @@ INSTALLEDVERSION=$(cat /etc/soversion)
INSTALLEDSALTVERSION=$(salt --versions-report | grep Salt: | awk {'print $2'})
default_salt_dir=/opt/so/saltstack/default
SOUP_BRANCH=$1
BATCHSIZE = 5
manager_check() {
# Check to see if this is a manager
@@ -196,6 +197,20 @@ verify_latest_update_script() {
fi
}
while getopts ":b" opt; do
case ${opt} in
b ) # process option b
if [[ $OPTARG =~ ^?[0-9]+$ ]] && [[ $OPTARG -gt 0 ]]; then
BATCHSIZE = $OPTARG
else
echo "Batch size must be a number greater than 0"
fi
;;
\? ) echo "Usage: cmd [-b]"
;;
esac
done
echo "Checking to see if this is a manager"
manager_check
echo "Cloning latest code to a temporary location"
@@ -254,3 +269,7 @@ echo "Running a highstate to complete upgrade"
highstate
echo ""
echo "Upgrade from $INSTALLEDVERSION to $NEWVERSION complete."
echo ""
echo "Upgrading the remaining Security Onion nodes from $INSTALLEDSALTVERSION to $NEWSALTVERSION"
salt -C 'not *_eval and not *_helix and not *_manager and not *_managersearch and not *_standalone' -b $BATCHSIZE state.apply salt.minion
echo ""