Page MenuHomeVyOS Platform

get_config_dict() and key_mangling=('-', '_') will alter CLI data for tagNodes
Closed, ResolvedPublicBUG

Description

When using key_mangling=('-', '_') the processor in the background will alter tagnodes and replace any - by _ which will cause faulty behavior as the data becomes invalid!

[email protected]# show system ntp
 server 172.16.100.10 {
 }
 server 172.16.100.20 {
 }
 server 172.16.110.30 {
 }
+server foo-bar.vyos.net {
+    prefer
+}
>>> from vyos.config import Config
>>> conf = Config()
>>> conf.get_config_dict(['system','ntp'], key_mangling=('-', '_'))
{'ntp': {'server': {'172.16.100.10': {}, '172.16.100.20': {}, '172.16.110.30': {}, 'foo_bar.vyos.net': {'prefer': {}}}}}
>>> conf.get_config_dict(['system','ntp'])
{'ntp': {'server': {'172.16.100.10': {}, '172.16.100.20': {}, '172.16.110.30': {}, 'foo-bar.vyos.net': {'prefer': {}}}}}

Workaround: https://github.com/vyos/vyos-1x/pull/511/files

Details

Version
1.3-rolling
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Internal change (not visible to end users)

Event Timeline

c-po assigned this task to dmbaturin.
c-po triaged this task as Urgent! priority.

I assume this will break 'system static-host-mapping host-name' and other places where tagnodes are used to carry string values as well

It will break everything when in use ;)

erkin set Issue type to Internal change (not visible to end users).Aug 29 2021, 1:46 PM
erkin removed a subscriber: Global Notifications.