From 781067cfd936bf028e8eb59fa86abade05ed313c Mon Sep 17 00:00:00 2001 From: iFargle Date: Wed, 22 Mar 2023 21:49:22 +0900 Subject: [PATCH] test --- renderer.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/renderer.py b/renderer.py index 0eb3f03..afc5427 100644 --- a/renderer.py +++ b/renderer.py @@ -252,7 +252,7 @@ def thread_machine_content(machine, machine_content, idx, all_routes): exit_route_found = False exit_route_enabled = False # If the device has enabled Failover routes (High Availability routes) - ha_routes = False + ha_enabled = False # If the length of "routes" is NULL/0, there are no routes, enabled or disabled: if len(pulled_routes["routes"]) > 0: @@ -308,9 +308,12 @@ def thread_machine_content(machine, machine_content, idx, all_routes): for route_info in all_routes["routes"]: if str(route_info["prefix"]) == str(route["prefix"]) and (route["prefix"] != "0.0.0.0/0" and route["prefix"] != "::/0"): if route_info["id"] != route["id"]: - app.logger.info("HA pair found: %s", str(route["prefix"])) + ha_enabled = False ha_routes = True + app.logger.info("HA pair found: %s", str(route["prefix"])) failover_pair_prefixes = str(route["prefix"]) + if route["enabled"]: + ha_enabled = True if route["prefix"] != "0.0.0.0/0" and route["prefix"] != "::/0" and route["prefix"] in failover_pair_prefixes: route_enabled = "red" route_tooltip = 'enable' @@ -431,8 +434,8 @@ def thread_machine_content(machine, machine_content, idx, all_routes): status_badge = "fiber_manual_record" user_badge = ""+machine["user"]["name"]+"" exit_node_badge = "" if not exit_route_enabled else "Exit" - ha_route_badge = "" if not ha_routes else "HA" - expiration_badge = "" if not expiring_soon else "Expiring!" + ha_route_badge = "" if not ha_enabled else "HA" + expiration_badge = "" if not expiring_soon else "Expiring!" machine_content[idx] = (str(render_template( 'machines_card.html',