Merge ~rostyslav-fridman/maas:fix/iproute-default-route-determination into maas:2.9.2-branch

Proposed by Rostyslav-fridman
Status: Superseded
Proposed branch: ~rostyslav-fridman/maas:fix/iproute-default-route-determination
Merge into: maas:2.9.2-branch
Diff against target: 42 lines (+26/-1)
1 file modified
src/provisioningserver/utils/iproute.py (+26/-1)
Reviewer Review Type Date Requested Status
MAAS Lander Needs Fixing
Adam Collard Pending
Review via email: mp+405302@code.launchpad.net

This proposal has been superseded by a proposal from 2021-07-07.

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b fix/iproute-default-route-determination lp:~rostyslav-fridman/maas/+git/maas into -b 2.9.2-branch lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci.internal:8080/job/maas/job/branch-tester/10406/console
COMMIT: 09d7497dc99b9c2556f57e8ed112db7298be0163

review: Needs Fixing
Revision history for this message
Alberto Donato (ack) wrote :

Note that the target for this MP should be 2.9, not 2.9.2-branch

Unmerged commits

09d7497... by Rostyslav Fridman <email address hidden>

Fix finding of default route

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/provisioningserver/utils/iproute.py b/src/provisioningserver/utils/iproute.py
2index 07d4f5b..38caa5c 100644
3--- a/src/provisioningserver/utils/iproute.py
4+++ b/src/provisioningserver/utils/iproute.py
5@@ -53,7 +53,31 @@ def parse_ip_route(output):
6 output = str(output, "utf-8")
7
8 routes = {}
9- for line in output.splitlines():
10+ spl = output.splitlines()
11+ multiline_route_marker = False
12+
13+ print(spl)
14+
15+ for idx, line in enumerate(spl):
16+ if idx + 1 == len(spl):
17+ break
18+
19+ if spl[idx + 1].startswith("\tnexthop"):
20+ print("Inside if")
21+ print(line)
22+ if multiline_route_marker:
23+ continue
24+
25+ subnet, _ = line.split(" ", 1)
26+ _, route = _parse_route_definition(spl[idx + 1])
27+
28+ routes[subnet] = route
29+ multiline_route_marker = True
30+
31+ if multiline_route_marker:
32+ multiline_route_marker = False
33+ continue
34+
35 subnet, route = _parse_route_definition(line)
36 routes[subnet] = route
37 return routes
38@@ -69,3 +93,4 @@ def get_ip_route():
39 ["ip", "route", "list", "scope", "global"]
40 )
41 return parse_ip_route(ip_route_output)
42+

Subscribers

People subscribed via source and target branches