infinoted: Add service only when setup is completed

- Inline with recent changes done.
This commit is contained in:
Sunil Mohan Adapa 2017-01-18 10:09:39 +05:30
parent fb8ac3b748
commit 414a59856d
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -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)