Skip to content

Commit a89e658

Browse files
committed
Only start services that still exist on state restore
Some services may be gone after upgrade (e.g. cf-consumer). Ticket: ENT-3385 Changelog: None
1 parent 3073718 commit a89e658

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packaging/common/script-templates/script-common.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ restore_cfengine_state() {
5353
# $1 -- file where the state to restore is saved (see get_cfengine_state())
5454

5555
if type systemctl >/dev/null 2>&1; then
56-
xargs -n1 -a "$1" systemctl start
56+
for service in `cat "$1"`; do
57+
definition=`systemctl cat "$service"` || continue
58+
# only try to start service that are defined/exist (some may be gone
59+
# in the new version)
60+
if [ -n "$definition" ]; then
61+
systemctl start "$service"
62+
fi
63+
done
5764
else
5865
CALLED_FROM_STATE_RESTORE=1
5966
if [ -f ${PREFIX}/bin/cfengine3-nova-hub-init-d.sh ]; then

0 commit comments

Comments
 (0)