upgrades: Restart FreedomBox service at end of dist-upgrade

This was removed in an earlier change, so restore it.

Avoids a transient "IndexError: list index out of range" error caused
by django when visiting a page.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2021-01-05 18:41:44 -05:00 committed by Sunil Mohan Adapa
parent 2ae60802a9
commit 8a3603cd5f
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -12,7 +12,8 @@ import subprocess
import sys
from plinth.action_utils import (apt_hold, debconf_set_selections,
run_apt_command, service_daemon_reload)
run_apt_command, service_daemon_reload,
service_restart)
from plinth.modules.apache.components import check_url
from plinth.modules.upgrades import (BACKPORTS_SOURCES_LIST, SOURCES_LIST,
get_current_release, is_backports_current)
@ -440,6 +441,11 @@ def _perform_dist_upgrade():
print('Running unattended-upgrade...', flush=True)
subprocess.run(['unattended-upgrade', '--verbose'])
# Restart FreedomBox service to ensure it is using the latest
# dependencies.
print('Restarting FreedomBox service...', flush=True)
service_restart('plinth')
# Update apt cache again to trigger force_upgrades.
print('Updating Apt cache...', flush=True)
run_apt_command(['update'])