From 3101ff1d6fb2da7aadd3ea4f5f17b677db841f50 Mon Sep 17 00:00:00 2001 From: Julien Fortin Date: Sat, 2 May 2020 19:14:09 +0200 Subject: [PATCH] ifupdownmain: syntax-check: l2protocol-tunnel: replace regex with str.split() Seems like the regex module might be behave a little bit different in python3. The regexes used to validate l2protocol-tunnel were returning incorrect lists: value=lldp,stp regex=['', 'l', 'l', 'd', 'p', '', 's', 't', 'p', ''] the patch simplifies the code by using str.translate and str.split Signed-off-by: Julien Fortin --- ifupdown2/ifupdown/ifupdownmain.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ifupdown2/ifupdown/ifupdownmain.py b/ifupdown2/ifupdown/ifupdownmain.py index a32d672..fa67000 100644 --- a/ifupdown2/ifupdown/ifupdownmain.py +++ b/ifupdown2/ifupdown/ifupdownmain.py @@ -1048,11 +1048,11 @@ class ifupdownMain: if '=' in value: for intf_arg in value.split(): intf_arg_split = intf_arg.split('=') - for arg in re.split(',|\s*', intf_arg_split[1]): + for arg in intf_arg_split[1].replace(",", " ").split(): if arg not in ['all', 'stp', 'lldp', 'lacp', 'cdp', 'pvst']: return False else: - for arg in re.split(',|\s*', value): + for arg in value.replace(",", " ").split(): if arg not in ['all', 'stp', 'lldp', 'lacp', 'cdp', 'pvst']: return False except: