[fix][wip] Add reinstall_init function (part 2)

Create a function that, if the setup log exists, puts the system into a state where
the installer can run again without issue.

This is WIP, there are most likely still issues.
This commit is contained in:
William Wernert
2020-11-03 15:44:37 -05:00
parent 00fc256c37
commit 93ab4b5d4f

View File

@@ -1412,21 +1412,22 @@ reserve_group_ids() {
} }
reinstall_init() { reinstall_init() {
is_reinstall=0
export is_reinstall
# Move last setup log to backup # Move last setup log to backup
mv $setup_log $setup_log.bak mv $setup_log $setup_log.bak
# Stop salt so it won't highstate and start containers back up. {
if [[ $install_type =~ ^(MANAGER|EVAL|HELIXSENSOR|MANAGERSEARCH|STANDALONE|IMPORT)$ ]]; then # Remove startup_states from minion config so we don't immediately highstate when salt starts back up
systemctl stop salt-master sed -i '/startup_states/d' $minion_config
fi
systemctl stop salt-minion
# Remove startup highstate from minion config so we don't immediately highstate when salt starts back up # Disable schedule so highstate doesn't start running during the install
sed -i '/startup_states/d' $minion_config salt-call -l info schedule.disable
# Stop all containers so files can be changed with more safety # Stop all containers so files can be changed with more safety
docker stop $(docker ps -a -q) docker stop $(docker ps -a -q)
} >> $setup_log 2>&1
} }
# When updating the salt version, also update the version in securityonion-builds/images/iso-task/Dockerfile and salt/salt/master.defaults.yaml and salt/salt/minion.defaults.yaml # When updating the salt version, also update the version in securityonion-builds/images/iso-task/Dockerfile and salt/salt/master.defaults.yaml and salt/salt/minion.defaults.yaml