pagekite: Remove app enabled checking from getting configuration

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa 2020-03-12 12:10:54 -07:00 committed by Veiko Aasa
parent 415452e730
commit 66b03a943b
No known key found for this signature in database
GPG Key ID: 478539CAE680674E
3 changed files with 10 additions and 4 deletions

View File

@ -71,7 +71,6 @@ def subcommand_get_config(_):
server_port = frontend[1] if len(frontend) >= 2 else '80' server_port = frontend[1] if len(frontend) >= 2 else '80'
status = { status = {
'is_enabled': action_utils.service_is_enabled('pagekite'),
'kite_name': aug.get(PATHS['kitename']), 'kite_name': aug.get(PATHS['kitename']),
'kite_secret': aug.get(PATHS['kitesecret']), 'kite_secret': aug.get(PATHS['kitesecret']),
'server_domain': server_domain, 'server_domain': server_domain,

View File

@ -90,7 +90,7 @@ def init():
app.set_enabled(True) app.set_enabled(True)
# Register kite name with Name Services module. # Register kite name with Name Services module.
utils.update_names_module(app) utils.update_names_module(is_enabled=True)
def setup(helper, old_version=None): def setup(helper, old_version=None):

View File

@ -161,17 +161,24 @@ def get_augeas_servicefile_path(protocol):
return os.path.join(CONF_PATH, relpath, 'service_on') return os.path.join(CONF_PATH, relpath, 'service_on')
def update_names_module(): def update_names_module(is_enabled=None):
"""Update the PageKite domain and services of the 'names' module.""" """Update the PageKite domain and services of the 'names' module."""
domain_removed.send_robust(sender='pagekite', domain_removed.send_robust(sender='pagekite',
domain_type='domain-type-pagekite') domain_type='domain-type-pagekite')
if is_enabled is False:
return
from plinth.modules.pagekite import app
if is_enabled is None and not app.is_enabled():
return
config = get_config() config = get_config()
enabled_services = [ enabled_services = [
service for service, value in config['predefined_services'].items() service for service, value in config['predefined_services'].items()
if value if value
] ]
if config['is_enabled'] and config['kite_name']: if config['kite_name']:
domain_added.send_robust(sender='pagekite', domain_added.send_robust(sender='pagekite',
domain_type='domain-type-pagekite', domain_type='domain-type-pagekite',
name=config['kite_name'], name=config['kite_name'],