Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

Commit 3d7b589c authored by Rob Carleski's avatar Rob Carleski 🇮🇸
Browse files

Account for even more ways groups end up with names in mcommunity.

* Also fix (intermittent?) issue with reserving group names with
* (.) and (_)
parent dae35dfc
......@@ -152,15 +152,22 @@ class Client:
if item['naming'].lower() == name.lower():
return item['dn'].lower()
elif item['group']:
if item['displayName'].lower() == name.lower():
hname = re.sub('[\._]', ' ', name).lower()
if item['displayName'].lower() == hname:
return item['dn'].lower()
encoded_dn = quote(item['dn'])
_group = self._patient_get('/profile/dn/{}'.format(
group = self._patient_get('/profile/dn/{}'.format(
if _group:
if name in _group['group'][0]['aliases']:
if group:
if isinstance(group['group'][0]['aliases'], list):
names = group['group'][0]['aliases']
names = [group['group'][0]['name']]
names = [x.lower() for x in names]
if hname in names:
return item['dn'].lower()
raise Exception('Unable to find {} in Mcommunity'.format(name))
......@@ -220,7 +227,6 @@ class Client:
if r.status_code ==
if 'umichgroup' in r.json()['group'][0]['objectClass']:
self.group_data = r.json()['group'][0]
......@@ -355,7 +361,7 @@ class Client:
name = self._validate_name(name)
endpoint = self.call_url + '/reserve'
data = {
'name': name
'name': re.sub('[\._]', ' ', name)
for x in range(int(self.retries)):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment