mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
action_utils: Don't restart web interface when installing an app
Tests: - systemd-run --pipe --property=BindReadOnlyPaths=/usr/share/freedombox/etc/needrestart/conf.d/freedombox-self.conf:/etc/needrestart/conf.d/freedombox-self.conf ls -la /etc/needrestart/conf.d/ shows that the new configuration is listed as expected. - Running about command with 'cat /etc/needrestart/conf.d/freedombox-self.conf' shows that configuration content is as expected. - Running functional tests for coturn app work as expected. systemd journal shows that transient services are being created to run apt commands. - After the execution of an operation an empty file is created as /etc/needrestart/conf.d/freedombox-self.conf. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
0e698eb4b4
commit
db92e23c75
3 files changed
+39
-3
No files matched your search
+13
@@ -0,0 +1,13 @@
|
||||
# Don't restart the freedombox web service. This configuration is only used when
|
||||
# apt command is invoked from freedombox web service itself (such as during an
|
||||
# app's installation/uninstallation).
|
||||
#
|
||||
# If this is not done, a freedombox web service restart is attempted.
|
||||
# needsrestart will wait until the restart is completed. apt command will wait
|
||||
# until needsrestart is completed. The restart mechanism in service will wait
|
||||
# until all currently running threads are completed. One thread that has invoked
|
||||
# this apt command will not finish as it waits for apt command to finish. This
|
||||
# results in a deadlock. Avoid this by not attempting to restart freedombox web
|
||||
# service when apt command is invoked from freedombox web service.
|
||||
$nrconf{override_rc}->{qr(^freedombox\.service$)} = 0;
|
||||
$nrconf{override_rc}->{qr(^plinth\.service$)} = 0;
|
||||
@@ -72,7 +72,8 @@ distribution_info: dict = {
|
||||
|
||||
def _apt_run(arguments: list[str]):
|
||||
"""Run an apt command and ensure that output is written to stdout."""
|
||||
returncode = action_utils.run_apt_command(arguments)
|
||||
returncode = action_utils.run_apt_command(arguments,
|
||||
allow_freedombox_restart=True)
|
||||
if returncode:
|
||||
raise RuntimeError(
|
||||
f'Apt command failed with return code: {returncode}')
|
||||
|
||||
Reference in new issue
Block a user