From 19a13918986388ad07422b130a5c8503fb5b12ad Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sat, 26 Sep 2020 00:19:45 +0000 Subject: [PATCH 1/2] [config] Reload Monit configuration after potential hostname changes --- config/main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config/main.py b/config/main.py index 4f3aeb6bb3..36c13348e2 100755 --- a/config/main.py +++ b/config/main.py @@ -750,6 +750,10 @@ def _restart_services(config_db): execute_systemctl(services_to_restart, SYSTEMCTL_ACTION_RESTART) + # Reload Monit configuration to pick up new hostname in case it changed + click.echo("Reloading Monit configuration ...") + clicommon.run_command("sudo monit reload") + def interface_is_in_vlan(vlan_member_table, interface_name): """ Check if an interface is in a vlan """ @@ -1233,6 +1237,11 @@ def hostname(new_hostname): except SystemExit as e: click.echo("Restarting hostname-config service failed with error {}".format(e)) raise + + # Reload Monit configuration to pick up new hostname in case it changed + click.echo("Reloading Monit configuration ...") + clicommon.run_command("sudo monit reload") + click.echo("Please note loaded setting will be lost after system reboot. To preserve setting, run `config save`.") # From 3298d97200c1feafe2b19848da7d84241f8eb3f8 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Tue, 6 Oct 2020 00:09:55 +0000 Subject: [PATCH 2/2] Update unit test to reflect change in output --- tests/config_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/config_test.py b/tests/config_test.py index 023f41337a..4fc6b87626 100644 --- a/tests/config_test.py +++ b/tests/config_test.py @@ -43,6 +43,7 @@ Executing restart of service hostcfgd... Executing restart of service nat... Executing restart of service telemetry... +Reloading Monit configuration ... Please note setting loaded from minigraph will be lost after system reboot. To preserve setting, run `config save`. """