net renderers miss metric value in per-subnet routes
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
When rendering a per-subnet route with a metric, the value is ignored due to clobbering of the looping variable.
Consider this v1 input:
{
"version": 1,
"config": [
{
"type": "physical",
"name": "eno3",
{
}
]
},
{
"type": "nameserver",
],
}
]
}
This should result in a netplan where we have a route entry with the correct gateway value and the metric, like this:
network:
version: 2
ethernets:
eno3:
- 192.168.14.13/24
match:
- 8.8.8.8
routes:
- metric: 10000
to: 192.168.14.0/24
via: 192.168.14.254
But instead, we get this:
network:
version: 2
ethernets:
eno3:
- 192.168.14.13/24
match:
- 8.8.8.8
routes:
- to: 192.168.14.0/24
via: 192.168.14.254
The bug is in here in _extract_addresses in cloudinit/
for route in subnet.
}
if 'metric' in route:
Related branches
- Server Team CI bot: Approve (continuous-integration)
- cloud-init Commiters: Pending requested
-
Diff: 1245 lines (+556/-145)23 files modifiedChangeLog (+54/-0)
bash_completion/cloud-init (+4/-1)
cloudinit/cmd/devel/net_convert.py (+10/-5)
cloudinit/cmd/main.py (+4/-16)
cloudinit/config/cc_write_files.py (+6/-1)
cloudinit/dhclient_hook.py (+72/-38)
cloudinit/net/eni.py (+15/-14)
cloudinit/net/netplan.py (+3/-3)
cloudinit/net/sysconfig.py (+21/-4)
cloudinit/sources/DataSourceAzure.py (+2/-2)
cloudinit/sources/DataSourceNoCloud.py (+31/-1)
cloudinit/sources/helpers/vmware/imc/config_nic.py (+2/-3)
cloudinit/tests/test_dhclient_hook.py (+105/-0)
cloudinit/version.py (+1/-1)
config/cloud.cfg.tmpl (+11/-1)
debian/changelog (+16/-0)
tests/cloud_tests/releases.yaml (+16/-0)
tests/unittests/test_cli.py (+8/-8)
tests/unittests/test_datasource/test_nocloud.py (+66/-34)
tests/unittests/test_handler/test_handler_write_files.py (+12/-0)
tests/unittests/test_net.py (+44/-6)
tests/unittests/test_vmware_config_file.py (+52/-6)
tox.ini (+1/-1)
- Chad Smith: Approve
- Server Team CI bot: Approve (continuous-integration)
-
Diff: 255 lines (+83/-27)4 files modifiedcloudinit/net/eni.py (+15/-14)
cloudinit/net/netplan.py (+3/-3)
cloudinit/net/sysconfig.py (+21/-4)
tests/unittests/test_net.py (+44/-6)
Note, this also affects the eni and sysconfig router as well.