diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-12-02 19:46:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-02 19:46:50 +0100 |
commit | 485c931b3203c2fda905b0b6d5f649937f990ef7 (patch) | |
tree | 7470f5514c0fa669fd0a4495b6bf6d607a16bc5c /python | |
parent | 5a871f0dac024c7c0c59f1a1709543c4cc5e4f96 (diff) | |
parent | c5aac0a6a1aba39b734a7b0f65ee4282fc72a605 (diff) | |
download | vyos-1x-485c931b3203c2fda905b0b6d5f649937f990ef7.tar.gz vyos-1x-485c931b3203c2fda905b0b6d5f649937f990ef7.zip |
Merge pull request #1093 from dmbaturin/basename-fix
T4035: correct the interface basename extraction logic to avoid confusing 'v' in GENEVE interface prefix ('gnv') with a "vXXX" part of a VRRP interface
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/ifconfig/section.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/python/vyos/ifconfig/section.py b/python/vyos/ifconfig/section.py index 0e4447b9e..91f667b65 100644 --- a/python/vyos/ifconfig/section.py +++ b/python/vyos/ifconfig/section.py @@ -52,12 +52,12 @@ class Section: name: name of the interface vlan: if vlan is True, do not stop at the vlan number """ - name = name.rstrip('0123456789') - name = name.rstrip('.') - if vlan: - name = name.rstrip('0123456789.') if vrrp: - name = name.rstrip('0123456789v') + name = re.sub(r'\d(\d|v|\.)*$', '', name) + elif vlan: + name = re.sub(r'\d(\d|\.)*$', '', name) + else: + name = re.sub(r'\d+$', '', name) return name @classmethod |