Page MenuHomeVyOS Platform

conf.get_config_dict() throws exception
Closed, ResolvedPublicBUG


vyos@vyos# show interfaces wirelessmodem
 wirelessmodem wlm10 {
+    backup {
+    }
>    description foo
+    device ttyUSB0
+    disable-link-detect
vyos@vyos# commit
[ interfaces wirelessmodem wlm10 ]
Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/", line 77, in <module>
    c = get_config()
  File "/usr/libexec/vyos/conf_mode/", line 50, in get_config
    tmp = conf.get_config_dict()
  File "/usr/lib/python3/dist-packages/vyos/", line 254, in get_config_dict
    config_tree = vyos.configtree.ConfigTree(res)
  File "/usr/lib/python3/dist-packages/vyos/", line 182, in __init__
    raise ValueError("Failed to parse config: {0}".format(msg))
ValueError: Failed to parse config: Syntax error on line 2, character 2: Invalid syntax.

[[interfaces wirelessmodem wlm10]] failed
Commit failed

Code to reproduce:


Difficulty level
Unknown (require assessment)
VyOS 1.3-rolling-202001251111
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

c-po created this task.
c-po updated the task description. (Show Details)

As expected,
(1) This is a parser error
(2) It is independent of any specific configuration script; it can be reproduced by calling conf.get_config_dict() with uncommitted changes, from any conf_mode script.

The issue arises when passing config changes, with the initial annotations '+'/'-' to configtree; it will pass in some very limited cases, but fail in general.

Further analysis is needed to understand the parser error. However, accommodating this case in the parser is not 'incorrect' behaviour, as those symbols are not a part of the config grammar. Consequently, we need to consider use cases and/or implementation of get_config_dict() .... in progress

Actually, upon reflection, the parser error is just too many terms on the line, hitting HandlingError; the rare exception exists, but is misleading, so 'use cases and/or implementation' ...

erkin set Issue type to Bug (incorrect behavior).Aug 31 2021, 5:50 PM