Merge pull request #1196 from Security-Onion-Solutions/feature/soup

Feature/soup
This commit is contained in:
Josh Patterson
2020-08-17 10:57:32 -04:00
committed by GitHub

View File

@@ -29,6 +29,7 @@ manager_check() {
MANAGERCHECK=$(cat /etc/salt/grains | grep role | awk '{print $2}')
if [[ "$MANAGERCHECK" =~ ^('so-eval'|'so-manager'|'so-standalone'|'so-managersearch'|'so-import')$ ]]; then
echo "This is a manager. We can proceed."
MINIONID=$(salt-call grains.get id --out=txt|awk -F: {'print $2'}|tr -d ' ')
else
echo "Please run soup on the manager. The manager controls all updates."
exit 0
@@ -89,6 +90,20 @@ highstate() {
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
# 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
# Moving baseurl from minion sls file to inside global.sls
local line=$(grep '^ url_base:' /opt/so/saltstack/local/pillar/minions/$MINIONID)
sed -i '/^ url_base:/d' /opt/so/saltstack/local/pillar/minions/$MINIONID;
sed -i "/^global:/a \\$line" /opt/so/saltstack/local/pillar/global.sls;
fi
}
update_dockers() {