Merge "Improve step task check to cater for whitespace"

This commit is contained in:
Zuul 2020-02-18 13:52:47 +00:00 committed by Gerrit Code Review
commit 93e98805a9
1 changed files with 3 additions and 1 deletions

View File

@ -126,9 +126,11 @@ class Config(object):
if not isinstance(whenexpr, list):
whenexpr = [whenexpr]
for w in whenexpr:
# remove all spaces to make the regex match easier
w = re.sub(r'\s+', '', w)
# make \|int optional incase forgotten; use only step digit:
# ()'s around step|int are also optional
match = re.search(r'\(?step(\|int)?\)? == ([0-9]+)$', "%s" % w)
match = re.search(r'\(?step(\|int)?\)?==([0-9]+)$', "%s" % w)
if match:
if match.group(2) == str(step):
return True