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 <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa 2025-09-17 13:46:17 -07:00 committed by Veiko Aasa
parent 288b58e0b5
commit 636b4cabd8
No known key found for this signature in database
GPG Key ID: 478539CAE680674E

View File

@ -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."""