From 636b4cabd89cbd6c2de77dd54461049d587b6c02 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 17 Sep 2025 13:46:17 -0700 Subject: [PATCH] actions: Work with older privileged daemon - Older privileged daemon before 25.10 did not return the stdout/stderr properties as part of an exception. During upgrade, there is a 5 minute time window (longer if the privileged daemon is continuously used) when privileged daemon is the old version and the service is the newer version. During this time any exception in the privileged task will cause this problem. - Our goal is not to always provide backward compatibility to old version of privileged daemon as the web interface and privileged daemon are expected to be upgraded at the same time. However, this one is easy and is complementary to a separate fix that addresses the core problem. Tests: - Perform an operation that raises an Exception in a privileged method. The error is properly shown as an HTML message but without stdout and stderr. Signed-off-by: Sunil Mohan Adapa Reviewed-by: Veiko Aasa --- plinth/actions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plinth/actions.py b/plinth/actions.py index 0f195da73..45dbc228b 100644 --- a/plinth/actions.py +++ b/plinth/actions.py @@ -170,8 +170,8 @@ def _wait_for_server_response(func, module_name, action_name, args, kwargs, module = importlib.import_module(return_value['exception']['module']) exception_class = getattr(module, return_value['exception']['name']) exception = exception_class(*return_value['exception']['args']) - exception.stdout = return_value['exception']['stdout'].encode() - exception.stderr = return_value['exception']['stderr'].encode() + exception.stdout = return_value['exception'].get('stdout', b'').encode() + exception.stderr = return_value['exception'].get('stderr', b'').encode() def _get_html_message(): """Return an HTML format error that can be shown in messages."""