Skip to content

Commit 31b8b05

Browse files
committed
utils_net: fix key error when trying to get default gateway
Signed-off-by: Haijiao Zhao <haizhao@redhat.com>
1 parent 6c649eb commit 31b8b05

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

virttest/utils_net.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4106,7 +4106,8 @@ def get_default_gateway_json(
41064106
default_route_list = [
41074107
x
41084108
for x in default_route_list
4109-
if x["metric"] == min([y["metric"] for y in default_route_list])
4109+
if x.get("metric")
4110+
== min([y.get("metric", float("inf")) for y in default_route_list])
41104111
]
41114112

41124113
default_route = default_route_list[0]

0 commit comments

Comments
 (0)