From 9701cbe89dbb22d6d0e95f21eeedb6fc78e196c9 Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Fri, 10 Mar 2023 13:54:37 +0000 Subject: T5058: Fix range_to_regex list argument Values of the list for the 'range_to_regex' could be not only range values as ['10-20', '22-30'] but also and not range values like ['10-20', '30', '80'] Fix if we args is list and non range values are exists in ths list % range_to_regex(['10-20', '80']) '(1\\d|20|80)' --- python/vyos/template.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/vyos/template.py b/python/vyos/template.py index 7f417992e..06a292706 100644 --- a/python/vyos/template.py +++ b/python/vyos/template.py @@ -675,7 +675,10 @@ def range_to_regex(num_range): if isinstance(num_range, list): data = [] for entry in num_range: - data.append(range_to_regex(entry)) + if '-' not in entry: + data.append(entry) + else: + data.append(range_to_regex(entry)) return f'({"|".join(data)})' if '-' not in num_range: -- cgit v1.2.3