refactored actions to use exceptions instead of return-values

This commit is contained in:
fonfon committed 2014-07-10 18:27:49 +03:00
1 parent a40d42eb60
commit 0d5636a900
12 files changed
+62 -72

No files matched your search

+2 -7
View File
@@ -140,16 +140,11 @@ 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, error = actions.superuser_run(command, arguments)
output = actions.superuser_run(command, arguments)
else:
output, error = actions.run(command, arguments)
if error:
raise Exception('Error setting/getting firewalld confguration - %s'
% error)
output = actions.run(command, arguments)
return output