Line number in route error is incorrect
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Netplan |
Triaged
|
Low
|
Unassigned | ||
One Hundred Papercuts |
Triaged
|
Low
|
Unassigned |
Bug Description
The following yaml produces an error during generation, but the wrong line number is reported which means I had to debug this error with gdb and a source build :/
============ BEGIN FILE =======
network:
version: 2
renderer: networkd
ethernets:
switch:
dhcp4: false
addresses: [ 192.168.50.1/24 ]
routing-
- from: 192.168.50.0/24
table: 128
routes:
- to: 0.0.0.0/0
via: 0.0.0.0
type: prohibit
table: 128
scope: global
- table: 128
to: 192.168.50.0/24
from: 192.168.50.1
on-link: true
=========== END FILE ===================
The line number in the error reported will be line 12 (the to:0.0.0.0) as shown below:
===================
test.yaml:12:9: Error in network definition: unicast route must include both a 'to' and 'via' IP
- to: 0.0.0.0/0
^
===================
However, this route is actually processed correctly and the error is in the following route starting on line 17.
Perhaps the first parameter to the code:
return yaml_error(node, error, "unicast route must include both a 'to' and 'via' IP");
should be the variable 'entry' rather than 'node'
Changed in netplan: | |
importance: | Undecided → Low |
status: | New → Triaged |
Changed in hundredpapercuts: | |
status: | New → Triaged |
importance: | Undecided → Low |