From fa6af06204a8a71e7607566f35399b2f81624201 Mon Sep 17 00:00:00 2001 From: Jason Ertel Date: Wed, 2 Jun 2021 17:13:59 -0400 Subject: [PATCH] Avoid running highstate during setup when flipping auth flag --- salt/common/tools/sbin/so-elastic-auth | 12 ++++++++---- setup/so-setup | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/salt/common/tools/sbin/so-elastic-auth b/salt/common/tools/sbin/so-elastic-auth index b15b04c0f..d4b8057a3 100644 --- a/salt/common/tools/sbin/so-elastic-auth +++ b/salt/common/tools/sbin/so-elastic-auth @@ -30,8 +30,10 @@ fi if [[ "$authEnable" == "true" ]]; then if grep -q "enabled: False" "$ES_AUTH_PILLAR"; then sed -i 's/enabled: False/enabled: True/g' "$ES_AUTH_PILLAR" - echo "Applying highstate - this may take a few minutes..." - salt-call state.highstate queue=True + if [[ -z "$ELASTIC_AUTH_SKIP_HIGHSTATE" ]]; then + echo "Applying highstate - this may take a few minutes..." + salt-call state.highstate queue=True + fi echo "Elastic auth is now enabled." if grep -q "argon" "$ES_USERS_FILE"; then echo "" @@ -44,8 +46,10 @@ if [[ "$authEnable" == "true" ]]; then elif [[ "$authEnable" == "false" ]]; then if grep -q "enabled: True" "$ES_AUTH_PILLAR"; then sed -i 's/enabled: True/enabled: False/g' "$ES_AUTH_PILLAR" - echo "Applying highstate - this may take a few minutes..." - salt-call state.highstate queue=True + if [[ -z "$ELASTIC_AUTH_SKIP_HIGHSTATE" ]]; then + echo "Applying highstate - this may take a few minutes..." + salt-call state.highstate queue=True + fi echo "Elastic auth is now disabled." else echo "Auth is already disabled." diff --git a/setup/so-setup b/setup/so-setup index 6d2f6ac27..ed6899db8 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -752,7 +752,7 @@ echo "1" > /root/accept_changes set_progress_str 60 "$(print_salt_state_apply 'manager')" salt-call state.apply -l info manager >> $setup_log 2>&1 - bash /opt/so/saltstack/default/salt/common/tools/sbin/so-elastic-auth + ELASTIC_AUTH_SKIP_HIGHSTATE=true bash /opt/so/saltstack/default/salt/common/tools/sbin/so-elastic-auth fi set_progress_str 61 "$(print_salt_state_apply 'firewall')"