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 2019-08-20 09:16:06 -07:00 committed by James Valleroy
parent 393f4bbc26
commit c30b3eb85c
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

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