summaryrefslogtreecommitdiff
path: root/src/helpers/vyos-load-balancer.py
diff options
context:
space:
mode:
authorAbhishek Safui <abhishek.safui@cdot.in>2025-06-24 21:33:14 +0530
committerAbhishek Safui <abhishek.safui@cdot.in>2025-06-24 21:33:14 +0530
commit5ef422734a5c4f8c211c0fa10a3c0fced9e3f8f0 (patch)
tree740906ba1413b22a63981f3b0b4a53d46f890b6a /src/helpers/vyos-load-balancer.py
parent195651aababa371d67c6e1608094891227a5bd18 (diff)
downloadvyos-1x-5ef422734a5c4f8c211c0fa10a3c0fced9e3f8f0.tar.gz
vyos-1x-5ef422734a5c4f8c211c0fa10a3c0fced9e3f8f0.zip
wan-load-balancing: T7567: Write health-status on first run
Write the health-status on the very first run of the script, without waiting for any change in status, to show the current state to the show command. In show command use the same api to get the now timestamp as used in state change timestamp.
Diffstat (limited to 'src/helpers/vyos-load-balancer.py')
-rwxr-xr-xsrc/helpers/vyos-load-balancer.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/helpers/vyos-load-balancer.py b/src/helpers/vyos-load-balancer.py
index 30329fd5c..5852dcdf4 100755
--- a/src/helpers/vyos-load-balancer.py
+++ b/src/helpers/vyos-load-balancer.py
@@ -246,6 +246,7 @@ if __name__ == '__main__':
# Main loop
+ init = True;
try:
while True:
ip_change = False
@@ -273,6 +274,11 @@ if __name__ == '__main__':
if state_changed and state['failure_count'] >= int(health_conf['failure_count']):
state['state'] = False
state['state_changed'] = True
+
+ #Force state changed to trigger the first write
+ if init == True:
+ state['state_changed'] = True
+ init = False
if state['state_changed']:
state['if_addr'] = get_ipv4_address(ifname)