tor: Minor fixes and styling

- Add note about resetarting firewalld.

- Refactor checking for running configuration process.

- Fix error message being show as info message.

- Minor indentation fixes.
This commit is contained in:
Sunil Mohan Adapa committed 2016-01-30 19:41:13 +05:30
1 parent e401a5a028
commit 65a1985cc0
2 files changed
+12 -5

No files matched your search

+8 -5
View File
@@ -82,6 +82,11 @@ def _apply_changes(request, old_status, new_status):
def __apply_changes(request, old_status, new_status):
"""Apply the changes."""
global config_process
if config_process:
# Already running a configuration task
return
arguments = []
if old_status['enabled'] != new_status['enabled']:
@@ -100,10 +105,8 @@ def __apply_changes(request, old_status, new_status):
arguments.extend(['--apt-transport-tor', arg_value])
if arguments:
global config_process
if not config_process:
config_process = actions.superuser_run(
'tor', ['configure'] + arguments, async=True)
config_process = actions.superuser_run(
'tor', ['configure'] + arguments, async=True)
else:
messages.info(request, _('Setting unchanged'))
@@ -144,6 +147,6 @@ def _collect_config_result(request):
if not return_code:
messages.success(request, _('Configuration updated.'))
else:
messages.info(request, _('Error occurred during configuration.'))
messages.error(request, _('An error occurred during configuration.'))
config_process = None