Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ldap_group_links.list() not usable #2738

Open
Labels
@zapp42

Description

@zapp42

Description of the problem, including code/CLI snippet

The current implementation of the list() method for the ldap_group_links api is not usable. The cli throws an exceptions and the api returns unusable data, because an id is missing.

$ gitlab group-ldap-group-link list --group-id xxxxxx
[, , , , , , ]
Traceback (most recent call last):
File "/home/rof/.local/bin/gitlab", line 8, in
sys.exit(main())
^^^^^^
File "/home/rof/.local/lib/python3.12/site-packages/gitlab/cli.py", line 389, in main
gitlab.v4.cli.run(
File "/home/rof/.local/lib/python3.12/site-packages/gitlab/v4/cli.py", line 556, in run
printer.display_list(data, fields, verbose=verbose)
File "/home/rof/.local/lib/python3.12/site-packages/gitlab/v4/cli.py", line 518, in display_list
self.display(get_dict(obj, fields), verbose=verbose, obj=obj)
File "/home/rof/.local/lib/python3.12/site-packages/gitlab/v4/cli.py", line 487, in display
id = getattr(obj, obj._id_attr)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/rof/.local/lib/python3.12/site-packages/gitlab/base.py", line 134, ingetattr
raise AttributeError(message)
AttributeError: 'GroupLDAPGroupLink' object has no attribute 'id'

I think the problem is, that the ldap_group_links api has two possible (exclusive) id fields: cn and filter. I did not find a way to reflect this in python-gitlab. As we do not use ldap filters in our Gitlab instance, my "fix" was to add

_id_attr = "cn"

to the GroupLDAPGroupLink class.

Expected Behavior

The data returned shall contain either a cn or filter field.

Actual Behavior

Returned data only has the provider attribute, which is useless without the other field(s).

Specifications

  • python-gitlab version: 4.2.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 16.5.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp