Write vrrp_script before (re)starting keepalived

Otherwise if keepalived decides to trigger the script before we write it
out, or when we fail to generate the script, then the router may become
broken.

Closes-Bug: 1674780
Change-Id: I2cea3159fd84c40506254fbd688cb1d745c9bf1c
This commit is contained in:
Ihar Hrachyshka 2017-03-20 20:36:29 +00:00
parent 96367092a0
commit 9ee58550e0
1 changed files with 4 additions and 4 deletions

View File

@ -416,6 +416,10 @@ class KeepalivedManager(object):
def spawn(self):
config_path = self._output_config_file()
for key, instance in six.iteritems(self.config.instances):
if instance.track_script:
instance.track_script.write_check_script()
keepalived_pm = self.get_process()
vrrp_pm = self._get_vrrp_process(
self.get_vrrp_pid_file_name(keepalived_pm.get_pid_file_name()))
@ -425,10 +429,6 @@ class KeepalivedManager(object):
keepalived_pm.enable(reload_cfg=True)
for key, instance in six.iteritems(self.config.instances):
if instance.track_script:
instance.track_script.write_check_script()
self.process_monitor.register(uuid=self.resource_id,
service_name=KEEPALIVED_SERVICE_NAME,
monitored_process=keepalived_pm)