Page MenuHomePhabricator

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?
Perfectly compatible

Event Timeline

dmbaturin changed the task status from Open to Needs testing.Jun 29 2019, 9:44 PM
pasik added a subscriber: pasik.Jul 2 2019, 3:28 PM
syncer assigned this task to zsdc.Aug 31 2019, 12:03 AM
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 closed this task as Resolved.Sep 6 2019, 4:59 PM
dmbaturin claimed this task.
dmbaturin set Is it a breaking change? to Perfectly compatible.
dmbaturin added a subscriber: zsdc.
c-po moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus board.Oct 13 2019, 3:05 PM