From 653857bfa8dcf8290da0daddfe231127befc271b Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Thu, 19 Mar 2026 16:02:08 +0100 Subject: vyos.ifconfig: T8047: add optional get_config_path() delimiter If we would like to get the CLI config path as a dot delimited string (instead of whitespace) we can now request it. This is usefull when feeding in the result of get_config_path() into dict_search(). --- python/vyos/ifconfig/section.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'python') diff --git a/python/vyos/ifconfig/section.py b/python/vyos/ifconfig/section.py index 7f110de04..c3f803c76 100644 --- a/python/vyos/ifconfig/section.py +++ b/python/vyos/ifconfig/section.py @@ -186,7 +186,7 @@ class Section: return list(cls._prefixes.keys()) @classmethod - def get_config_path(cls, name): + def get_config_path(cls, name, delimiter=' '): """ get config path to interface with .vif or .vif-s.vif-c example: eth0.1.2 -> 'ethernet eth0 vif-s 1 vif-c 2' @@ -195,11 +195,11 @@ class Section: sect = cls.section(name) if sect: splinterface = name.split('.') - intfpath = f'{sect} {splinterface[0]}' + intfpath = f'{sect}{delimiter}{splinterface[0]}' if len(splinterface) == 2: - intfpath += f' vif {splinterface[1]}' + intfpath += f'{delimiter}vif{delimiter}{splinterface[1]}' elif len(splinterface) == 3: - intfpath += f' vif-s {splinterface[1]} vif-c {splinterface[2]}' + intfpath += f'{delimiter}vif-s{delimiter}{splinterface[1]}{delimiter}vif-c{delimiter}{splinterface[2]}' return intfpath else: return False -- cgit v1.2.3