cockpit: Apply domain name changes immediately

Without restarting cockpit, newly added/removed domain in cockpit configuration
file do not immediately work. Either the daemon has to stop itself due to
inactivity (it is socket activated by systemd) or system needs to be restarted.
Without the patch, if cockpit is not currently running (due to socket activation
not having happened yet) the domain name changes would be noticeable
immediately.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2019-08-21 21:35:13 -04:00
1 parent 393f4bbc26
commit c30b3eb85c
1 file changed
+2
+2
View File
@@ -132,6 +132,7 @@ def on_domain_added(sender, domain_type, name, description='', services=None,
setup_helper = globals()['setup_helper']
if setup_helper.get_state() != 'needs-setup':
actions.superuser_run('cockpit', ['add-domain', name])
actions.superuser_run('service', ['try-restart', managed_services[0]])
def on_domain_removed(sender, domain_type, name, **kwargs):
@@ -139,3 +140,4 @@ def on_domain_removed(sender, domain_type, name, **kwargs):
setup_helper = globals()['setup_helper']
if setup_helper.get_state() != 'needs-setup':
actions.superuser_run('cockpit', ['remove-domain', name])
actions.superuser_run('service', ['try-restart', managed_services[0]])