Skip to content

Commit 5c2f70f

Browse files
authored
Merge pull request #4575 from abhisheksafui/t7567_load_balance_show_fix
wan-load-balancing: T7567: Write health-status on first run
2 parents 195651a + 5ef4227 commit 5c2f70f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/helpers/vyos-load-balancer.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ def handle_sigterm(signum, frame):
246246

247247
# Main loop
248248

249+
init = True;
249250
try:
250251
while True:
251252
ip_change = False
@@ -273,6 +274,11 @@ def handle_sigterm(signum, frame):
273274
if state_changed and state['failure_count'] >= int(health_conf['failure_count']):
274275
state['state'] = False
275276
state['state_changed'] = True
277+
278+
#Force state changed to trigger the first write
279+
if init == True:
280+
state['state_changed'] = True
281+
init = False
276282

277283
if state['state_changed']:
278284
state['if_addr'] = get_ipv4_address(ifname)

src/op_mode/load-balancing_wan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def _get_formatted_output(raw_data):
6262
change_dt = datetime.fromtimestamp(latest_change) if latest_change > 0 else None
6363
success_dt = datetime.fromtimestamp(if_data['last_success']) if if_data['last_success'] > 0 else None
6464
failure_dt = datetime.fromtimestamp(if_data['last_failure']) if if_data['last_failure'] > 0 else None
65-
now = datetime.utcnow()
65+
now = datetime.fromtimestamp(time.time())
6666

6767
fmt_data = {
6868
'ifname': ifname,

0 commit comments

Comments
 (0)