Page MenuHomeVyOS Platform

Malformed lines cause vyos.util.colon_separated_to_dict fail with a nondescript error
Closed, ResolvedPublic


If you try to parse strings that don't follow the expected "colon-separated pair on every non-empty line" format with vyos.util.colon_separated_to_dict(), you get a non-informative unassigned variable error that doesn't provide any insight into the cause or debugging hints.

>>> import vyos.util
>>> vyos.util.colon_separated_to_dict("no colon in this line, lmao")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/vyos/", line 334, in colon_separated_to_dict
    if key in data.keys():
UnboundLocalError: local variable 'key' referenced before assignment

I believe such errors should explain what happened and show the offending line.


Difficulty level
Unknown (require assessment)
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Internal change (not visible to end users)

Related Objects

Mentioned In