privoxy: Remove get-enabled from actions

This commit is contained in:
Sunil Mohan Adapa 2015-07-12 11:56:47 +05:30 committed by James Valleroy
parent cedec9b624
commit 4906384b39
3 changed files with 14 additions and 18 deletions

View File

@ -37,8 +37,6 @@ def parse_arguments():
subparsers.add_parser('setup',
help='Perform Privoxy configuration setup')
subparsers.add_parser('get-enabled',
help='Get whether Privoxy service is enabled')
subparsers.add_parser('enable', help='Enable Privoxy service')
subparsers.add_parser('disable', help='Disable Privoxy service')
@ -65,12 +63,6 @@ def subcommand_setup(_):
action_utils.service_restart('privoxy')
def subcommand_get_enabled(_):
"""Get whether service is enabled."""
is_enabled = action_utils.service_is_enabled('privoxy')
print('yes' if is_enabled else 'no')
def subcommand_enable(_):
"""Start service."""
action_utils.service_enable('privoxy')

View File

@ -22,6 +22,7 @@ Plinth module to configure Privoxy.
from gettext import gettext as _
from plinth import actions
from plinth import action_utils
from plinth import cfg
from plinth import service as service_module
@ -37,10 +38,17 @@ def init():
menu.add_urlname(_('Web Proxy (Privoxy)'), 'glyphicon-cloud-upload',
'privoxy:index', 50)
output = actions.run('privoxy', ['get-enabled'])
enabled = (output.strip() == 'yes')
global service
service = service_module.Service(
'privoxy', _('Privoxy Web Proxy'),
is_external=False, enabled=enabled)
is_external=False, enabled=is_enabled())
def is_enabled():
"""Return whether the module is enabled."""
return action_utils.service_is_enabled('privoxy')
def is_running():
"""Return whether the service is running."""
return action_utils.service_is_running('privoxy')

View File

@ -26,7 +26,6 @@ import logging
from .forms import PrivoxyForm
from plinth import actions
from plinth import action_utils
from plinth import package
from plinth.modules import privoxy
@ -63,11 +62,8 @@ def index(request):
def get_status():
"""Get the current settings from server."""
output = actions.run('privoxy', ['get-enabled'])
enabled = (output.strip() == 'yes')
status = {'enabled': enabled,
'is_running': action_utils.service_is_running('privoxy')}
status = {'enabled': privoxy.is_enabled(),
'is_running': privoxy.is_running()}
return status