diff options
author | Daniel Walton <dwalton@cumulusnetworks.com> | 2016-09-23 16:02:55 +0200 |
---|---|---|
committer | Daniel Walton <dwalton@cumulusnetworks.com> | 2016-09-23 16:02:55 +0200 |
commit | 0c515adf432ee0d02d38edc34de7666faaf323ba (patch) | |
tree | 2ff84dda57b0236981db4c6af9765ca1b4993758 /tools | |
parent | bgpd: fix hosed CMD_RANGE_STR (diff) | |
download | frr-0c515adf432ee0d02d38edc34de7666faaf323ba.tar.xz frr-0c515adf432ee0d02d38edc34de7666faaf323ba.zip |
zebra: compress multiple whitespaces in command string
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/argv_translator.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/argv_translator.py b/tools/argv_translator.py index 1c8f0c7e5..4ee0831ed 100755 --- a/tools/argv_translator.py +++ b/tools/argv_translator.py @@ -267,6 +267,11 @@ DEFUN (no_bgp_maxmed_onstartup, line = line.replace('}', ']') re_range = re.search('^(.*?)<(\d+-\d+)>(.*)$', line) + # A one off to handle "CMD_RANGE_STR(1, MULTIPATH_NUM)" + if 'CMD_RANGE_STR<' in line: + line = line.replace('CMD_RANGE_STR<', 'CMD_RANGE_STR(') + line = line.replace('>', ')') + while re_range: line = "%s(%s)%s" % (re_range.group(1), re_range.group(2), re_range.group(3)) re_range = re.search('^(.*?)<(\d+-\d+)>(.*)$', line) @@ -274,6 +279,9 @@ DEFUN (no_bgp_maxmed_onstartup, if not line.endswith('\n'): line += '\n' + # compress duplicate whitespaces + re_space = re.search('^(\s*).*(\s*)$', line) + line = re_space.group(1) + ' '.join(line.split()) + re_space.group(2) return line def dump(self): |