diff options
author | Daniil Baturin <daniil@vyos.io> | 2025-06-26 09:58:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-26 09:58:36 +0100 |
commit | 5c2f70ffd82047740a91be949af5098a6ee39c2c (patch) | |
tree | 740906ba1413b22a63981f3b0b4a53d46f890b6a | |
parent | 195651aababa371d67c6e1608094891227a5bd18 (diff) | |
parent | 5ef422734a5c4f8c211c0fa10a3c0fced9e3f8f0 (diff) | |
download | vyos-1x-5c2f70ffd82047740a91be949af5098a6ee39c2c.tar.gz vyos-1x-5c2f70ffd82047740a91be949af5098a6ee39c2c.zip |
Merge pull request #4575 from abhisheksafui/t7567_load_balance_show_fix
wan-load-balancing: T7567: Write health-status on first run
-rwxr-xr-x | src/helpers/vyos-load-balancer.py | 6 | ||||
-rwxr-xr-x | src/op_mode/load-balancing_wan.py | 2 |
2 files changed, 7 insertions, 1 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) diff --git a/src/op_mode/load-balancing_wan.py b/src/op_mode/load-balancing_wan.py index 9fa473802..e1e2e8109 100755 --- a/src/op_mode/load-balancing_wan.py +++ b/src/op_mode/load-balancing_wan.py @@ -62,7 +62,7 @@ def _get_formatted_output(raw_data): change_dt = datetime.fromtimestamp(latest_change) if latest_change > 0 else None success_dt = datetime.fromtimestamp(if_data['last_success']) if if_data['last_success'] > 0 else None failure_dt = datetime.fromtimestamp(if_data['last_failure']) if if_data['last_failure'] > 0 else None - now = datetime.utcnow() + now = datetime.fromtimestamp(time.time()) fmt_data = { 'ifname': ifname, |