Dmitry Tantsur cecbc860dd DIB: allow disabling rescue mode
Change-Id: Ife73d59b8e5c4454634d0e6c4f23daaf7cc9fb66
2019-10-09 09:32:04 +00:00

46 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
DIB_IPA_ENABLE_RESCUE=${DIB_IPA_ENABLE_RESCUE:-true}
install-packages -e cloud-init
rm -rf /tmp/ironic-python-agent
if $DIB_IPA_ENABLE_RESCUE; then
# Make sure rescue works
mkdir -p /etc/ipa-rescue-config
fi
case "$DIB_INIT_SYSTEM" in
upstart)
if [ -f /etc/init/ufw.conf ]; then
mv /etc/init/ufw.conf /etc/init/ufw.conf.disabled
fi
if [ -f /etc/init/tgt.conf ]; then
mv /etc/init/tgt.conf /etc/init/tgt.conf.disabled
fi
;;
systemd)
if [[ $(systemctl --no-pager list-unit-files iptables) =~ 'enabled' ]]; then
systemctl disable iptables.service
fi
systemctl enable $(svc-map ironic-python-agent).service
if $DIB_IPA_ENABLE_RESCUE; then
systemctl enable ironic-agent-create-rescue-user.path
fi
;;
sysv)
update-rc.d iptables disable
;;
*)
echo "Unsupported init system"
exit 1
;;
esac