From 4ea2fa499c720e0f8af20df5e646c351de29daf4 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 3 Jul 2019 11:39:18 -0700 Subject: [PATCH] cockpit: Don't handle domains if app is not installed Signed-off-by: Sunil Mohan Adapa Reviewed-by: Joseph Nuthalapati --- plinth/modules/cockpit/__init__.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plinth/modules/cockpit/__init__.py b/plinth/modules/cockpit/__init__.py index 7bd47a4a4..178123211 100644 --- a/plinth/modules/cockpit/__init__.py +++ b/plinth/modules/cockpit/__init__.py @@ -132,15 +132,21 @@ def diagnose(): def on_domain_added(sender, domain_type, name, description='', services=None, **kwargs): """Handle addition of a new domain.""" - actions.superuser_run('cockpit', ['add-domain', name]) + setup_helper = globals()['setup_helper'] + if setup_helper.get_state() != 'needs-setup': + actions.superuser_run('cockpit', ['add-domain', name]) def on_domain_removed(sender, domain_type, name, **kwargs): """Handle removal of a domain.""" - actions.superuser_run('cockpit', ['remove-domain', name]) + setup_helper = globals()['setup_helper'] + if setup_helper.get_state() != 'needs-setup': + actions.superuser_run('cockpit', ['remove-domain', name]) def on_domainname_change(sender, old_domainname, new_domainname, **kwargs): """Handle change of a domain.""" - actions.superuser_run('cockpit', ['remove-domain', old_domainname]) - actions.superuser_run('cockpit', ['add-domain', new_domainname]) + setup_helper = globals()['setup_helper'] + if setup_helper.get_state() != 'needs-setup': + actions.superuser_run('cockpit', ['remove-domain', old_domainname]) + actions.superuser_run('cockpit', ['add-domain', new_domainname])