ironic-agent postinst fails on systemd with no iptables

Where the base install for the image uses systemd but
the iptables service is not present, the postinstall
script for the ironic-agent element can fail. This is
due to 'systemctl disable iptables.service' returning
an error status when the service isn't present. Check
whether the service is enabled using 'systemctl
list-unit-files'.

Change-Id: I8069b062a27caead4097747d7aeae24a5262e117
This commit is contained in:
stephane 2016-03-21 17:59:26 -07:00
parent 29d9eeaa7f
commit dd7648277f

View File

@ -17,7 +17,9 @@ case "$DIB_INIT_SYSTEM" in
fi fi
;; ;;
systemd) systemd)
if [[ $(systemctl --no-pager list-unit-files iptables) =~ 'enabled' ]]; then
systemctl disable iptables.service systemctl disable iptables.service
fi
systemctl enable $(svc-map ironic-python-agent).service systemctl enable $(svc-map ironic-python-agent).service
;; ;;
sysv) sysv)