Commit 313de912 authored by Henrik Skov Midtiby's avatar Henrik Skov Midtiby

Only enter a class if the name matches exactly.

parent 7d53eb15
......@@ -170,15 +170,16 @@ class GitlabClassHelper:
url = self.path + '/groups/%d/subgroups?search=%s' % (id_of_parent_group, group_name)
resp = requests.get(url, headers=self.headers)
if resp.ok:
if len(resp.json()) == 1:
idx = resp.json()[0]['id']
self.group_id = idx
web_url = resp.json()[0]['web_url']
print('Entering the "%s" group in gitlab.' % group_name)
print('web_url to the group: %s' % web_url)
print('Id of the group: %d' % idx)
print('Working in this group now.')
return idx
for group_candidate in resp.json():
if(group_name == group_candidate['name']):
idx = group_candidate['id']
self.group_id = idx
web_url = group_candidate['web_url']
print('Entering the "%s" group in gitlab.' % group_name)
print('web_url to the group: %s' % web_url)
print('Id of the group: %d' % idx)
print('Working in this group now.')
return idx
else:
raise NameError('%d groups found in group: %d when searching on %s' % (len(resp.json()), id_of_parent_group, group_name))
else:
......
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