searx: Use action utils for uwsgi configuration management

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2019-01-14 15:15:54 -08:00 committed by James Valleroy
parent 2c59bbe0f3
commit bed43564c3
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 3 additions and 11 deletions

View File

@ -152,20 +152,14 @@ def subcommand_setup(_):
def subcommand_enable(_):
"""Enable web configuration and reload."""
if not os.path.exists('/etc/uwsgi/apps-enabled/searx.ini'):
os.symlink('/etc/uwsgi/apps-available/searx.ini',
'/etc/uwsgi/apps-enabled/searx.ini')
action_utils.service_enable('uwsgi')
action_utils.service_restart('uwsgi')
action_utils.uwsgi_enable('searx')
action_utils.webserver_enable('searx-freedombox')
def subcommand_disable(_):
"""Disable web configuration and reload."""
action_utils.webserver_disable('searx-freedombox')
os.unlink('/etc/uwsgi/apps-enabled/searx.ini')
action_utils.service_restart('uwsgi')
action_utils.uwsgi_disable('searx')
def main():

View File

@ -18,8 +18,6 @@
FreedomBox app to configure Searx.
"""
import os
from django.utils.translation import ugettext_lazy as _
from plinth import service as service_module
@ -105,7 +103,7 @@ def get_safe_search_setting():
def is_enabled():
"""Return whether the module is enabled."""
return (action_utils.webserver_is_enabled('searx-freedombox')
and os.path.exists('/etc/uwsgi/apps-enabled/searx.ini'))
and action_utils.uwsgi_is_enabled('searx'))
def enable():