mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
Improve exception handle when running actions
- Don't use depricated exception.message. Instead using exception.args - Pass stdout output along with stderr in exception - Handle possible exceptions such as ValueError, OSError in all cases - Log all command executions and their errors
This commit is contained in:
1 parent
b77c97e088
commit
642a4e10ff
6 files changed
+30
-29
No files matched your search
@@ -140,11 +140,8 @@ def on_service_enabled(sender, service_id, enabled, **kwargs):
|
||||
def _run(arguments, superuser=False):
|
||||
"""Run an given command and raise exception if there was an error"""
|
||||
command = 'firewall'
|
||||
LOGGER.info('Running command - %s, %s, %s', command, arguments, superuser)
|
||||
|
||||
if superuser:
|
||||
output = actions.superuser_run(command, arguments)
|
||||
return actions.superuser_run(command, arguments)
|
||||
else:
|
||||
output = actions.run(command, arguments)
|
||||
|
||||
return output
|
||||
return actions.run(command, arguments)
|
||||
Reference in new issue
Block a user