So, Andres let me know that MAAS already tries to do that by restarting Postgres even when in a chroot with this bit in maas-region-controller.postinst:
deb-systemd-invoke restart postgresql || true
However, trying out "systemctl restart postgresql" in a chroot fails with the "Running in a chroot, ignoring request" error message, so perhaps systemctl has grown this ability recently. Calling "/etc/init.d/postgresql restart" or "service postgresql restart" worked, so we can use that as a work-around, though I am not sure how long this is going to continue working.
So, Andres let me know that MAAS already tries to do that by restarting Postgres even when in a chroot with this bit in maas-region- controller. postinst:
deb-systemd-invoke restart postgresql || true
However, trying out "systemctl restart postgresql" in a chroot fails with the "Running in a chroot, ignoring request" error message, so perhaps systemctl has grown this ability recently. Calling "/etc/init. d/postgresql restart" or "service postgresql restart" worked, so we can use that as a work-around, though I am not sure how long this is going to continue working.