cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #01487
[Merge] ~smoser/cloud-init:bug/1649652-curtin-routes-rendered into cloud-init:master
Scott Moser has proposed merging ~smoser/cloud-init:bug/1649652-curtin-routes-rendered into cloud-init:master.
Requested reviews:
cloud init development team (cloud-init-dev)
Related bugs:
Bug #1649652 in MAAS: "[MAAS 2.1.2] Issue with adding routes to hosts via maas"
https://bugs.launchpad.net/maas/+bug/1649652
For more details, see:
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/313475
--
Your team cloud init development team is requested to review the proposed merge of ~smoser/cloud-init:bug/1649652-curtin-routes-rendered into cloud-init:master.
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index 789c78b..81b43a8 100755
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -769,6 +769,52 @@ class TestEniRoundTrip(TestCase):
entry['expected_eni'].splitlines(),
files['/etc/network/interfaces'].splitlines())
+ def test_routes_rendered(self):
+ # as reported in bug 1649652
+ conf = [
+ {'name': 'eth0', 'type': 'physical',
+ 'subnets': [{
+ 'address': '172.23.31.42/26',
+ 'dns_nameservers': [], 'gateway': '172.23.31.2',
+ 'type': 'static'}]},
+ {'type': 'route', 'id': 4,
+ 'metric': 0, 'destination': '10.0.0.0/12',
+ 'gateway': '172.23.31.1'},
+ {'type': 'route', 'id': 5,
+ 'metric': 0, 'destination': '192.168.2.0/16',
+ 'gateway': '172.23.31.1'},
+ {'type': 'route', 'id': 6,
+ 'metric': 1, 'destination': '10.0.200.0/16',
+ 'gateway': '172.23.31.1'},
+ ]
+
+ files = self._render_and_read(
+ network_config={'config': conf, 'version': 1})
+ expected = [
+ 'auto lo',
+ 'iface lo inet loopback',
+ 'auto eth0',
+ 'iface eth0 inet static',
+ ' address 172.23.31.42/26',
+ ' gateway 172.23.31.2',
+ ('post-up route add -net 10.0.0.0 netmask 255.240.0.0 gw '
+ '172.23.31.1 metric 0 || true'),
+ ('pre-down route del -net 10.0.0.0 netmask 255.240.0.0 gw '
+ '172.23.31.1 metric 0 || true'),
+ ('post-up route add -net 192.168.2.0 netmask 255.255.0.0 gw '
+ '172.23.31.1 metric 0 || true'),
+ ('pre-down route del -net 192.168.2.0 netmask 255.255.0.0 gw '
+ '172.23.31.1 metric 0 || true'),
+ ('post-up route add -net 10.0.200.0 netmask 255.255.0.0 gw '
+ '172.23.31.1 metric 1 || true'),
+ ('pre-down route del -net 10.0.200.0 netmask 255.255.0.0 gw '
+ '172.23.31.1 metric 1 || true'),
+ ]
+ found = files['/etc/network/interfaces'].splitlines()
+
+ self.assertEqual(
+ expected, [line for line in found if line])
+
def _gzip_data(data):
with io.BytesIO() as iobuf:
Follow ups