mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
roundcube: Remove get-enabled from actions
This commit is contained in:
parent
4906384b39
commit
384867dc25
@ -29,7 +29,6 @@ from plinth import action_utils
|
||||
|
||||
|
||||
APACHE_CONF = '/etc/apache2/conf-available/roundcube.conf'
|
||||
APACHE_ENABLED_CONF = '/etc/apache2/conf-enabled/roundcube.conf'
|
||||
|
||||
|
||||
def parse_arguments():
|
||||
@ -41,8 +40,6 @@ def parse_arguments():
|
||||
help='Perform Roundcube pre-install configuration')
|
||||
subparsers.add_parser('setup',
|
||||
help='Perform Roundcube configuration setup')
|
||||
subparsers.add_parser('get-enabled',
|
||||
help='Get whether Roundcube service is enabled')
|
||||
subparsers.add_parser('enable', help='Enable Roundcube')
|
||||
subparsers.add_parser('disable', help='Disable Roundcube')
|
||||
|
||||
@ -75,25 +72,14 @@ def subcommand_setup(_):
|
||||
action_utils.service_reload('apache2')
|
||||
|
||||
|
||||
def subcommand_get_enabled(_):
|
||||
"""Get whether service is enabled."""
|
||||
try:
|
||||
subprocess.check_output(['a2query', '-c', 'roundcube'])
|
||||
print('yes')
|
||||
except subprocess.CalledProcessError:
|
||||
print('no')
|
||||
|
||||
|
||||
def subcommand_enable(_):
|
||||
"""Start service."""
|
||||
subprocess.call(['a2enconf', 'roundcube'])
|
||||
action_utils.service_reload('apache2')
|
||||
"""Enable web configuration and reload."""
|
||||
action_utils.webserver_enable('roundcube')
|
||||
|
||||
|
||||
def subcommand_disable(_):
|
||||
"""Stop service."""
|
||||
subprocess.call(['a2disconf', 'roundcube'])
|
||||
action_utils.service_reload('apache2')
|
||||
"""Disable web configuration and reload."""
|
||||
action_utils.webserver_disable('roundcube')
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@ -22,6 +22,7 @@ Plinth module to configure Roundcube.
|
||||
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
|
||||
|
||||
@ -34,3 +35,7 @@ def init():
|
||||
menu = cfg.main_menu.get('apps:index')
|
||||
menu.add_urlname(_('Email Client (Roundcube)'), 'glyphicon-envelope',
|
||||
'roundcube:index', 50)
|
||||
|
||||
def is_enabled():
|
||||
"""Return whether the module is enabled."""
|
||||
return action_utils.webserver_is_enabled('roundcube')
|
||||
|
||||
@ -27,6 +27,7 @@ import logging
|
||||
from .forms import RoundcubeForm
|
||||
from plinth import actions
|
||||
from plinth import package
|
||||
from plinth.modules import roundcube
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -67,10 +68,7 @@ def index(request):
|
||||
|
||||
def get_status():
|
||||
"""Get the current status."""
|
||||
output = actions.run('roundcube', ['get-enabled'])
|
||||
enabled = (output.strip() == 'yes')
|
||||
|
||||
return {'enabled': enabled}
|
||||
return {'enabled': roundcube.is_enabled()}
|
||||
|
||||
|
||||
def _apply_changes(request, old_status, new_status):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user