Make pipeline approval username requirement a regular expression
This now matches the trigger username requirement which is already
a regex.
Change-Id: Ib88998de9057f6605b8bbb6c52ab9bd2486b2e83
diff --git a/zuul/model.py b/zuul/model.py
index ca8f098..46b0b98 100644
--- a/zuul/model.py
+++ b/zuul/model.py
@@ -1079,7 +1079,7 @@
for a in approvals:
for k, v in a.items():
if k == 'username':
- pass
+ a['username'] = re.compile(v)
elif k in ['email', 'email-filter']:
a['email'] = re.compile(v)
elif k == 'newer-than':
@@ -1098,7 +1098,7 @@
by = approval.get('by', {})
for k, v in rapproval.items():
if k == 'username':
- if (by.get('username', '') != v):
+ if (not v.search(by.get('username', ''))):
return False
elif k == 'email':
if (not v.search(by.get('email', ''))):