diff --git a/salt/common/tools/sbin/soup b/salt/common/tools/sbin/soup index 849ba9f09..1b1688809 100755 --- a/salt/common/tools/sbin/soup +++ b/salt/common/tools/sbin/soup @@ -121,54 +121,49 @@ pillar_changes() { # This function is to add any new pillar items if needed. echo "Checking to see if pillar changes are needed." - # Move baseurl in global.sls - if [[ "$INSTALLEDVERSION" =~ rc.1 ]]; then - rc1_to_rc2 - rc2_to_rc3 - fi - - if [[ "$INSTALLEDVERSION" =~ rc.2 ]]; then - rc2_to_rc3 - fi + [[ "$INSTALLEDVERSION" =~ rc.1 ]] && rc1_to_rc2 + [[ "$INSTALLEDVERSION" =~ rc.2 ]] && rc2_to_rc3 } rc1_to_rc2() { # Move the static file to global.sls - echo "Migrating static.sls to global.sls" - mv -v /opt/so/saltstack/local/pillar/static.sls /opt/so/saltstack/local/pillar/global.sls >> "$SOUP_LOG" 2>&1 - sed -i '1c\global:' /opt/so/saltstack/local/pillar/global.sls >> "$SOUP_LOG" 2>&1 + echo "Migrating static.sls to global.sls" + mv -v /opt/so/saltstack/local/pillar/static.sls /opt/so/saltstack/local/pillar/global.sls >> "$SOUP_LOG" 2>&1 + sed -i '1c\global:' /opt/so/saltstack/local/pillar/global.sls >> "$SOUP_LOG" 2>&1 - # Moving baseurl from minion sls file to inside global.sls - local line=$(grep '^ url_base:' /opt/so/saltstack/local/pillar/minions/$MINIONID.sls) - sed -i '/^ url_base:/d' /opt/so/saltstack/local/pillar/minions/$MINIONID.sls; - sed -i "/^global:/a \\$line" /opt/so/saltstack/local/pillar/global.sls; + # Moving baseurl from minion sls file to inside global.sls + local line=$(grep '^ url_base:' /opt/so/saltstack/local/pillar/minions/$MINIONID.sls) + sed -i '/^ url_base:/d' /opt/so/saltstack/local/pillar/minions/$MINIONID.sls; + sed -i "/^global:/a \\$line" /opt/so/saltstack/local/pillar/global.sls; - # Adding play values to the global.sls - local HIVEPLAYSECRET=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) - local CORTEXPLAYSECRET=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) - sed -i "/^global:/a \\ hiveplaysecret: $HIVEPLAYSECRET" /opt/so/saltstack/local/pillar/global.sls; - sed -i "/^global:/a \\ cortexplaysecret: $CORTEXPLAYSECRET" /opt/so/saltstack/local/pillar/global.sls; + # Adding play values to the global.sls + local HIVEPLAYSECRET=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) + local CORTEXPLAYSECRET=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) + sed -i "/^global:/a \\ hiveplaysecret: $HIVEPLAYSECRET" /opt/so/saltstack/local/pillar/global.sls; + sed -i "/^global:/a \\ cortexplaysecret: $CORTEXPLAYSECRET" /opt/so/saltstack/local/pillar/global.sls; - # Move storage nodes to hostname for SSL - # Get a list we can use: - grep -A1 searchnode /opt/so/saltstack/local/pillar/data/nodestab.sls | grep -v '\-\-' | sed '$!N;s/\n/ /' | awk '{print $1,$3}' | awk '/_searchnode:/{gsub(/\_searchnode:/, "_searchnode"); print}' >/tmp/nodes.txt - # Remove the nodes from cluster settings - while read p; do - local NAME=$(echo $p | awk '{print $1}') - local IP=$(echo $p | awk '{print $2}') - echo "Removing the old cross cluster config for $NAME" - curl -XPUT -H 'Content-Type: application/json' http://localhost:9200/_cluster/settings -d '{"persistent":{"cluster":{"remote":{"'$NAME'":{"skip_unavailable":null,"seeds":null}}}}}' - done /tmp/nodes.txt + # Remove the nodes from cluster settings + while read p; do + local NAME=$(echo $p | awk '{print $1}') + local IP=$(echo $p | awk '{print $2}') + echo "Removing the old cross cluster config for $NAME" + curl -XPUT -H 'Content-Type: application/json' http://localhost:9200/_cluster/settings -d '{"persistent":{"cluster":{"remote":{"'$NAME'":{"skip_unavailable":null,"seeds":null}}}}}' + done > /opt/so/saltstack/local/salt/idstools/local.rules + fi + rm -rf /opt/so/saltstack/local/salt/idstools/localrules + rm -rf /opt/so/saltstack/default/salt/idstools/localrules # Rename ZEEKVERSION to MDENGINE