mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* Update gitlab_project_members.py
The actual search method doesn't accept path with namespace for project_name. If you have many project with same name, this module gitlab_project_members can't work.
* Update gitlab_project_members.py
* Update gitlab_project_members.py
* Update gitlab_project_members.py
* Create 3602-fix-gitlab_project_members-improve-search-method
* Rename 3602-fix-gitlab_project_members-improve-search-method to 3602-fix-gitlab_project_members-improve-search-method.yml
(cherry picked from commit cdfc4dcf49
)
Co-authored-by: paytroff <93038288+paytroff@users.noreply.github.com>
This commit is contained in:
parent
f4d16549de
commit
9e19286a9f
2 changed files with 10 additions and 4 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- gitlab_project_members - ``get_project_id`` return the project id by matching ``full_path`` or ``name`` (https://github.com/ansible-collections/community.general/pull/3602).
|
|
@ -48,7 +48,7 @@ options:
|
||||||
type: str
|
type: str
|
||||||
project:
|
project:
|
||||||
description:
|
description:
|
||||||
- The name of the GitLab project the member is added to/removed from.
|
- The name (or full path) of the GitLab project the member is added to/removed from.
|
||||||
required: true
|
required: true
|
||||||
type: str
|
type: str
|
||||||
gitlab_user:
|
gitlab_user:
|
||||||
|
@ -118,6 +118,10 @@ class GitLabProjectMembers(object):
|
||||||
self._gitlab = gl
|
self._gitlab = gl
|
||||||
|
|
||||||
def get_project(self, project_name):
|
def get_project(self, project_name):
|
||||||
|
try:
|
||||||
|
project_exists = self._gitlab.projects.get(project_name)
|
||||||
|
return project_exists.id
|
||||||
|
except gitlab.exceptions.GitlabGetError as e:
|
||||||
project_exists = self._gitlab.projects.list(search=project_name)
|
project_exists = self._gitlab.projects.list(search=project_name)
|
||||||
if project_exists:
|
if project_exists:
|
||||||
return project_exists[0].id
|
return project_exists[0].id
|
||||||
|
|
Loading…
Reference in a new issue