From fa154f1a8f86793b6afaf61762baf27131b1f4f5 Mon Sep 17 00:00:00 2001 From: Josh Patterson Date: Mon, 3 Nov 2025 14:12:19 -0500 Subject: [PATCH] update salt cloud config if configured --- salt/manager/tools/sbin/soup | 16 ++++++++-------- salt/salt/cloud/config.sls | 5 +++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/salt/manager/tools/sbin/soup b/salt/manager/tools/sbin/soup index 8fd3f0b64..291744e50 100755 --- a/salt/manager/tools/sbin/soup +++ b/salt/manager/tools/sbin/soup @@ -22,7 +22,7 @@ NOTIFYCUSTOMELASTICCONFIG=false TOPFILE=/opt/so/saltstack/default/salt/top.sls BACKUPTOPFILE=/opt/so/saltstack/default/salt/top.sls.backup SALTUPGRADED=false -SALT_CLOUD_INSTALLED=false +SALT_CLOUD_CONFIGURED=false # used to display messages to the user at the end of soup declare -a FINAL_MESSAGE_QUEUE=() @@ -1266,9 +1266,9 @@ upgrade_salt() { echo "" # If rhel family if [[ $is_rpm ]]; then - # Check if salt-cloud is installed - if rpm -q salt-cloud &>/dev/null; then - SALT_CLOUD_INSTALLED=true + # Check if salt-cloud is configured + if [[ -f /etc/salt/cloud.profiles.d/socloud.conf ]]; then + SALT_CLOUD_CONFIGURED=true fi echo "Removing yum versionlock for Salt." @@ -1277,7 +1277,7 @@ upgrade_salt() { yum versionlock delete "salt-minion" yum versionlock delete "salt-master" # Remove salt-cloud versionlock if installed - if [[ $SALT_CLOUD_INSTALLED == true ]]; then + if [[ $SALT_CLOUD_CONFIGURED == true ]]; then yum versionlock delete "salt-cloud" fi echo "Updating Salt packages." @@ -1286,7 +1286,7 @@ upgrade_salt() { # if oracle run with -r to ignore repos set by bootstrap if [[ $OS == 'oracle' ]]; then # Add -L flag only if salt-cloud is already installed - if [[ $SALT_CLOUD_INSTALLED == true ]]; then + if [[ $SALT_CLOUD_CONFIGURED == true ]]; then run_check_net_err \ "sh $UPDATE_DIR/salt/salt/scripts/bootstrap-salt.sh -X -r -L -F -M stable \"$NEWSALTVERSION\"" \ "Could not update salt, please check $SOUP_LOG for details." @@ -1308,7 +1308,7 @@ upgrade_salt() { yum versionlock add "salt-minion-0:$NEWSALTVERSION-0.*" yum versionlock add "salt-master-0:$NEWSALTVERSION-0.*" # Add salt-cloud versionlock if installed - if [[ $SALT_CLOUD_INSTALLED == true ]]; then + if [[ $SALT_CLOUD_CONFIGURED == true ]]; then yum versionlock add "salt-cloud-0:$NEWSALTVERSION-0.*" fi # Else do Ubuntu things @@ -1587,7 +1587,7 @@ main() { # ensure the mine is updated and populated before highstates run, following the salt-master restart update_salt_mine - if [[ $SALT_CLOUD_INSTALLED == true && $SALTUPGRADED == true ]]; then + if [[ $SALT_CLOUD_CONFIGURED == true && $SALTUPGRADED == true ]]; then echo "Updating salt-cloud config to use the new Salt version" salt-call state.apply salt.cloud.config concurrent=True fi diff --git a/salt/salt/cloud/config.sls b/salt/salt/cloud/config.sls index 8b5e15fe1..dce0e873a 100644 --- a/salt/salt/cloud/config.sls +++ b/salt/salt/cloud/config.sls @@ -36,6 +36,11 @@ cloud_profiles: SALTVERSION: {{ SALTVERSION }} - template: jinja - makedirs: True +{% else %} +no_hypervisors_configured: + test.succeed_without_changes: + - name: no_hypervisors_configured + - comment: No hypervisors are configured {% endif %} {% else %}