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 -8
View File
@@ -196,16 +196,10 @@ def _apply_changes(request, old_status, new_status):
def _run(arguments, superuser=True):
"""Run an given command and raise exception if there was an error"""
command = 'pagekite-configure'
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 PageKite confguration - %s'
% error)
output = actions.run(command, arguments)
return output