From 414a59856d5349a8c523d03cbd49898c9884e521 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 18 Jan 2017 10:09:39 +0530 Subject: [PATCH] infinoted: Add service only when setup is completed - Inline with recent changes done. --- plinth/modules/infinoted/__init__.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/plinth/modules/infinoted/__init__.py b/plinth/modules/infinoted/__init__.py index 3f0e7f3b6..ab40af91b 100644 --- a/plinth/modules/infinoted/__init__.py +++ b/plinth/modules/infinoted/__init__.py @@ -59,12 +59,14 @@ def init(): menu.add_urlname(title, 'glyphicon-pencil', 'infinoted:index') global service - service = service_module.Service( - managed_services[0], title, ports=['infinoted-plinth'], - is_external=True, enable=enable, disable=disable) + setup_helper = globals()['setup_helper'] + if setup_helper.get_state() != 'needs-setup': + service = service_module.Service( + managed_services[0], title, ports=['infinoted-plinth'], + is_external=True, enable=enable, disable=disable) - if service.is_enabled(): - add_shortcut() + if service.is_enabled(): + add_shortcut() class InfinotedServiceView(ServiceView): @@ -77,6 +79,12 @@ def setup(helper, old_version=None): """Install and configure the module.""" helper.install(managed_packages) helper.call('post', actions.superuser_run, 'infinoted', ['setup']) + global service + if service is None: + service = service_module.Service( + managed_services[0], title, ports=['infinoted-plinth'], + is_external=True, enable=enable, disable=disable) + helper.call('post', service.notify_enabled, None, True) helper.call('post', add_shortcut)