Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitlab_issue: title attribute not used when listing #7846

Closed
1 task done
gpongelli opened this issue Jan 15, 2024 · 6 comments · Fixed by #7847
Closed
1 task done

gitlab_issue: title attribute not used when listing #7846

gpongelli opened this issue Jan 15, 2024 · 6 comments · Fixed by #7847
Labels
bug This issue/PR relates to a bug has_pr module module plugins plugin (any type)

Comments

@gpongelli
Copy link
Contributor

gpongelli commented Jan 15, 2024

Summary

Using gitlab_issue module, title string is required but it's not used by underlying library python_gitlab's list method.

More specifically, this call into gitlab_issue module passes a keyword "title" to python-gitlab library, that does not use it for "list" method.

What happens is that many issues are returned, filtering only through the state (that's an admitted filter), ignoring the title.

Issue Type

Bug Report

Component Name

gitlab_issue

Ansible Version

$ ansible --version
ansible [core 2.16.2]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/.cache/pypoetry/virtualenvs/gitlab-user-checks-bxct1Kz8-py3.11/lib/python3.11/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /root/.cache/pypoetry/virtualenvs/gitlab-user-checks-bxct1Kz8-py3.11/bin/ansible
  python version = 3.11.7 (main, Dec  8 2023, 14:22:46) [GCC 13.2.0] (/root/.cache/pypoetry/virtualenvs/gitlab-user-checks-bxct1Kz8-py3.11/bin/python)
  jinja version = 3.1.3
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general


# /root/.cache/pypoetry/virtualenvs/gitlab-user-checks-bxct1Kz8-py3.11/lib/python3.11/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 8.1.0

Configuration

$ ansible-config dump --only-changed

OS / Environment

debian trixie

Steps to Reproduce

  - name: Change assignee
    community.general.gitlab_issue:
      api_url: "{{ api_url }}"
      api_token: "{{ access_token }}"
      project: "existing-project"
      title: "title copied from gitlab issue page"
      assignee_ids:
        - assignee
      state: present

Expected Results

title parameter used to filter gitlab's issue, or another way to obtain only one issue to be then changed.

task above should be executed changing the issue's assignee, searched through title, with specified one.

Actual Results

fatal: [localhost]: FAILED! => {"changed": false, "msg": "Multiple Issues matched search criteria."}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Solution

"search" is the keyword to be used, instead of "title".

@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module plugins plugin (any type) labels Jan 15, 2024
@nejch
Copy link
Contributor

nejch commented Jan 15, 2024

python-gitlab passes any kind of list filters to the API, the code you linked is used internally for the CLI rather than the python client. I'll double check but I doubt this is the case.

@gpongelli
Copy link
Contributor Author

I forgot to mention that the case I’ve error is when doing an issue update.

Furthermore, those are the gitlab api and there’s no mention about title as attribute while listing, but search is there.

@felixfontein
Copy link
Collaborator

Is it possible that it was title for an older version of GitLab, and eventually changed to the more generic search?

@gpongelli
Copy link
Contributor Author

Is it possible that it was title for an older version of GitLab, and eventually changed to the more generic search?

I’m not aware of this change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug has_pr module module plugins plugin (any type)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants