Page MenuHomeVyOS Platform

libvyosconfig error reporting doesn't include line numbers
Closed, ResolvedPublicBUG

Description

Right now all you can get if your config fails to parse is the character position in the file, which is very unfriendly.

Adding line number and position to the error messages would already be an improvement, even before we have real parse errors.

Details

Difficulty level
Unknown (require assessment)
Version
1.2.0
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)

Event Timeline

dmbaturin changed the task status from Open to Needs testing.Jun 29 2019, 9:44 PM
syncer triaged this task as Normal priority.
syncer edited projects, added VyOS 1.3 Equuleus; removed VyOS 1.2 Crux.
>>> s="""
... foo {
...   bar {
...     baz quux foo
...   }
... }
... """
>>> import vyos.configtree
>>> c = vyos.configtree.ConfigTree(s)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/vyos/configtree.py", line 167, in __init__
    raise ValueError("Failed to parse config: {0}".format(msg))
ValueError: Failed to parse config: Syntax error on line 4, character 14: Invalid syntax.
dmbaturin claimed this task.
dmbaturin set Is it a breaking change? to Unspecified (possibly destroys the router).
dmbaturin added a subscriber: zsdc.