From bba73980de9d8f0d2ccb322444e192323553d198 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sun, 3 Oct 2021 15:15:26 -0400 Subject: [PATCH] Revamp postinst for the API daemon Ensures that the worker is always restarted and make the NOTE conditional more specific. --- debian/pvc-daemon-api.postinst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/debian/pvc-daemon-api.postinst b/debian/pvc-daemon-api.postinst index 9c04b468..a127aae1 100644 --- a/debian/pvc-daemon-api.postinst +++ b/debian/pvc-daemon-api.postinst @@ -5,11 +5,16 @@ systemctl daemon-reload # Restart the main daemon and apply database migrations (or warn on first install) if systemctl is-active --quiet pvcapid.service; then - systemctl stop pvcapid-worker.service systemctl stop pvcapid.service /usr/share/pvc/pvc-api-db-upgrade systemctl start pvcapid.service +fi +# Restart the worker daemon +if systemctl is-active --quiet pvcapid-worker.service; then + systemctl stop pvcapid-worker.service systemctl start pvcapid-worker.service -else +fi + +if [[ ! -f /etc/pvc/pvcapid.yaml ]]; then echo "NOTE: The PVC client API daemon (pvcapid.service) and the PVC provisioner worker daemon (pvcapid-worker.service) have not been started; create a config file at /etc/pvc/pvcapid.yaml, then run the database configuration (/usr/share/pvc/pvc-api-db-upgrade) and start them manually." fi