From 855a99cc21e24c225eb2560821c4934deb8e0a8a Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 20 Aug 2019 09:21:47 -0700 Subject: [PATCH] config: Send hostname change signal only after fully processing it If the domain name is not properly set before calling post_hostname_change signal, then in the signal handlers config.get_domainname() returns an empty string. So, call the post_hostname_change signal only after fully finishing the hostname related changes, that is, after setting back the original domain name too. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/config/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plinth/modules/config/views.py b/plinth/modules/config/views.py index a0f264c30..8b2988633 100644 --- a/plinth/modules/config/views.py +++ b/plinth/modules/config/views.py @@ -134,12 +134,12 @@ def set_hostname(hostname): LOGGER.info('Changing hostname to - %s', hostname) actions.superuser_run('hostname-change', [hostname]) - post_hostname_change.send_robust( - sender='config', old_hostname=old_hostname, new_hostname=hostname) - LOGGER.info('Setting domain name after hostname change - %s', domainname) actions.superuser_run('domainname-change', [domainname]) + post_hostname_change.send_robust( + sender='config', old_hostname=old_hostname, new_hostname=hostname) + def set_domainname(domainname, old_domainname): """Sets machine domain name to domainname"""