handle debian family salt upgrade for soup

This commit is contained in:
m0duspwnens
2023-10-19 13:46:48 -04:00
parent 84f8e1cc92
commit 90bde94371

View File

@@ -629,19 +629,20 @@ upgrade_salt() {
SALTUPGRADED=True SALTUPGRADED=True
echo "Performing upgrade of Salt from $INSTALLEDSALTVERSION to $NEWSALTVERSION." echo "Performing upgrade of Salt from $INSTALLEDSALTVERSION to $NEWSALTVERSION."
echo "" echo ""
# If Oracle Linux # If rhel family
if [[ $OS == 'oel' || $OS == 'centos' || $OS == 'rocky' ]]; then if [[ $is_rpm ]]; then
echo "Removing yum versionlock for Salt." echo "Removing yum versionlock for Salt."
echo "" echo ""
yum versionlock delete "salt-*" yum versionlock delete "salt-*"
echo "Updating Salt packages." echo "Updating Salt packages."
echo "" echo ""
set +e set +e
if [[ $OS == 'oel' ]]; then # if oracle run with -r to ignore repos set by bootstrap
if [[ $OS == 'oracle' ]]; then
run_check_net_err \ run_check_net_err \
"sh $UPDATE_DIR/salt/salt/scripts/bootstrap-salt.sh -X -r -F -M -x python3 stable \"$NEWSALTVERSION\"" \ "sh $UPDATE_DIR/salt/salt/scripts/bootstrap-salt.sh -X -r -F -M -x python3 stable \"$NEWSALTVERSION\"" \
"Could not update salt, please check $SOUP_LOG for details." "Could not update salt, please check $SOUP_LOG for details."
# if rocky or centos we want to run without -r to allow the bootstrap script to manage repos # if another rhel family variant we want to run without -r to allow the bootstrap script to manage repos
else else
run_check_net_err \ run_check_net_err \
"sh $UPDATE_DIR/salt/salt/scripts/bootstrap-salt.sh -X -F -M -x python3 stable \"$NEWSALTVERSION\"" \ "sh $UPDATE_DIR/salt/salt/scripts/bootstrap-salt.sh -X -F -M -x python3 stable \"$NEWSALTVERSION\"" \
@@ -652,6 +653,24 @@ upgrade_salt() {
echo "" echo ""
yum versionlock add "salt-*" yum versionlock add "salt-*"
# Else do Ubuntu things # Else do Ubuntu things
elif [[ $is_deb ]]; then
echo "Removing apt hold for Salt."
echo ""
apt-mark unhold "salt-common"
apt-mark unhold "salt-master"
apt-mark unhold "salt-minion"
echo "Updating Salt packages."
echo ""
set +e
run_check_net_err \
"sh $UPDATE_DIR/salt/salt/scripts/bootstrap-salt.sh -X -F -M -x python3 stable \"$NEWSALTVERSION\"" \
"Could not update salt, please check $SOUP_LOG for details."
set -e
echo "Applying apt hold for Salt."
echo ""
apt-mark hold "salt-common"
apt-mark hold "salt-master"
apt-mark hold "salt-minion"
fi fi
echo "Checking if Salt was upgraded." echo "Checking if Salt was upgraded."
@@ -663,7 +682,7 @@ upgrade_salt() {
echo "Once the issue is resolved, run soup again." echo "Once the issue is resolved, run soup again."
echo "Exiting." echo "Exiting."
echo "" echo ""
exit 0 exit 1
else else
echo "Salt upgrade success." echo "Salt upgrade success."
echo "" echo ""
@@ -793,7 +812,7 @@ main() {
if [[ $is_airgap -eq 0 ]]; then if [[ $is_airgap -eq 0 ]]; then
yum clean all yum clean all
check_os_updates check_os_updates
elif [[ $OS == 'oel' ]]; then elif [[ $OS == 'oracle' ]]; then
# sync remote repo down to local if not airgap # sync remote repo down to local if not airgap
repo_sync repo_sync
check_os_updates check_os_updates