actions: Log full exception from privileged daemon on error

- This make it easy to find issues when looking at either main service logs or
privileged daemon logs.

Tests:

- Raise an exception in one of the privileged actions. Notice that the exception
is printed along with module name, action_name, stdout, stderr and traceback.

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-25 15:04:40 -07:00 committed by Veiko Aasa
parent 5566f05cad
commit a43082308d
No known key found for this signature in database
GPG Key ID: 478539CAE680674E

View File

@ -503,6 +503,11 @@ def _privileged_call(module_name, action_name, arguments):
return_value = {'result': 'success', 'return': return_values}
except Exception as exception:
return_value = get_return_value_from_exception(exception)
logger.exception(
'Error running action: %s..%s(..): %s\nstdout:\n%s\nstderr:\n%s\n',
module_name, action_name, exception,
return_value['exception']['stdout'],
return_value['exception']['stderr'])
return return_value