summaryrefslogtreecommitdiff
path: root/cloudinit/net/netplan.py
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2018-12-11 17:24:11 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2018-12-11 17:24:11 +0000
commit6aef6c7d402b17ebc04516a088a91f8e6ed86510 (patch)
tree91b7b816fa74cd67ca9a5c456599db42c4a6fa44 /cloudinit/net/netplan.py
parenta4007d063f96b82545aa678ef2cb472ea3b48b1e (diff)
downloadvyos-cloud-init-6aef6c7d402b17ebc04516a088a91f8e6ed86510.tar.gz
vyos-cloud-init-6aef6c7d402b17ebc04516a088a91f8e6ed86510.zip
net: render 'metric' values in per-subnet routes
It is possible to have a metric value in a per-subnet route. This is currently missing in all renderers. Update each renderer to emit the correct metric value from the config. LP: #1805871
Diffstat (limited to 'cloudinit/net/netplan.py')
-rw-r--r--cloudinit/net/netplan.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/cloudinit/net/netplan.py b/cloudinit/net/netplan.py
index bc1087f9..21517fda 100644
--- a/cloudinit/net/netplan.py
+++ b/cloudinit/net/netplan.py
@@ -114,13 +114,13 @@ def _extract_addresses(config, entry, ifname):
for route in subnet.get('routes', []):
to_net = "%s/%s" % (route.get('network'),
route.get('prefix'))
- route = {
+ new_route = {
'via': route.get('gateway'),
'to': to_net,
}
if 'metric' in route:
- route.update({'metric': route.get('metric', 100)})
- routes.append(route)
+ new_route.update({'metric': route.get('metric', 100)})
+ routes.append(new_route)
addresses.append(addr)