1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[PR #7847/8ea58618 backport][stable-8] gitlab_issue: use search instead of title (#7977)

gitlab_issue: use search instead of title (#7847)

* gitlab_issue: use search instead of title

* Create changelog file

* Update changelogs/fragments/7847-gitlab-issue-title.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* using query_parameters

Co-authored-by: Nejc Habjan <hab.nejc@gmail.com>

* sanity checks

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Nejc Habjan <hab.nejc@gmail.com>
(cherry picked from commit 8ea58618db)

Co-authored-by: Gabriele Pongelli <gpongelli@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2024-02-17 22:48:48 +01:00 committed by GitHub
parent 8eec4767bd
commit 359788e0cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- gitlab_issue - fix behavior to search GitLab issue, using ``search`` keyword instead of ``title`` (https://github.com/ansible-collections/community.general/issues/7846).

View file

@ -183,7 +183,7 @@ class GitlabIssue(object):
def get_issue(self, title, state_filter): def get_issue(self, title, state_filter):
issues = [] issues = []
try: try:
issues = self.project.issues.list(title=title, state=state_filter) issues = self.project.issues.list(query_parameters={"search": title, "in": "title", "state": state_filter})
except gitlab.exceptions.GitlabGetError as e: except gitlab.exceptions.GitlabGetError as e:
self._module.fail_json(msg="Failed to list the Issues: %s" % to_native(e)) self._module.fail_json(msg="Failed to list the Issues: %s" % to_native(e))