Fix regexes in yaml-validate.py with python 3.8
In Python 3.8, the re module no longer escapes various characters (such as ; or /), as opposed to python 3.6. Update various regexes in yaml-validate.py to match patterns as expected for all python versions. Change-Id: Ica7a01b10bc9483acdf7468bec2f8840ee3f7170 Closes-Bug: #1883722
This commit is contained in:
parent
0b519bfc72
commit
832f71096d
@ -1034,7 +1034,7 @@ def validate_service_hiera_interpol(f, tpl):
|
||||
# name. The only exception is allow anything under
|
||||
# str_replace['params'] ('str_replace;params' in the str notation).
|
||||
# We need to escape because of '$' char may be in templated params.
|
||||
query = re.compile(r'\\;str(\\)?_replace\\;params\\;\S*?net',
|
||||
query = re.compile(r'(\\)?;str(\\)?_replace(\\)?;params(\\)?;\S*?net',
|
||||
re.IGNORECASE)
|
||||
if not query.search(re.escape(path_str)):
|
||||
# Keep parsing, if foo_vip_network, or anything
|
||||
@ -1046,7 +1046,7 @@ def validate_service_hiera_interpol(f, tpl):
|
||||
|
||||
# Omit mappings in tht, like:
|
||||
# [NetXxxMap, <... ,> {get_param: [ServiceNetMap, ...
|
||||
if re.search(r'Map.*get\\_param', re.escape(path_str)):
|
||||
if re.search(r'Map.*get(\\)?_param', re.escape(path_str)):
|
||||
continue
|
||||
|
||||
# For the remaining cases, verify if there is a template
|
||||
|
Loading…
Reference in New Issue
Block a user