From 60df37d9a1b33ae5d4f2455651482e939fdd4ffe Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 19 Jan 2026 16:18:18 +0100 Subject: 🚀 Debian package: python-django-ishtar - verify there is no import before restarting services MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/python3-django-ishtar.postinst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'debian/python3-django-ishtar.postinst') diff --git a/debian/python3-django-ishtar.postinst b/debian/python3-django-ishtar.postinst index f892eaddd..bd10818e1 100644 --- a/debian/python3-django-ishtar.postinst +++ b/debian/python3-django-ishtar.postinst @@ -41,7 +41,7 @@ case "$1" in instances="$( (cat $INSTANCES_FILE 2>/dev/null || true) | xargs )" if [ -n "$instances" ]; then if [ -f /usr/sbin/rabbitmqctl ]; then # assume queues are configured - cecho c "Verify rabbitmq queues are empty" + cecho c "Verify rabbitmq queues are empty and no import is currently running" for instance in $instances; do for res in `rabbitmqctl list_queues -p /ishtar$instance -q messages`; do if [ $res != 0 ] && [ $res != 'messages' ]; then @@ -49,6 +49,12 @@ case "$1" in cecho y "Wait a few minutes (hours?) for update." exit 1 fi; + NB_IMPORT=$(sudo su - postgres -c "/usr/bin/psql -X -A -t -d ishtar-$instance -c \"SELECT count(id) FROM ishtar_common_import WHERE state IN ('IP', 'IQ')\"") + if [ $NB_IMPORT != '0' ]; then + cecho r "There are imports on $instance." + cecho y "Wait a few minutes (hours?) for update." + exit 1 + fi; done done fi -- cgit v1.2.3