FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gitlab project-merge-request-approval-rule list throws a KeyError "approval_rule_id" error. · Issue #2065 · python-gitlab/python-gitlab · GitHub

Repository navigation

gitlab project-merge-request-approval-rule list throws a KeyError "approval_rule_id" error. #2065

Description

Description of the problem, including code/CLI snippet

$ gitlab project-merge-request-approval-rule list --mr-iid 1 --project-id foo/bar

Expected Behavior

A list of approval rules

Actual Behavior

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/gitlab/base.py", line 107, in __getattr__
    return self.__dict__["_updated_attrs"][name]
KeyError: 'approval_rule_id'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/gitlab/base.py", line 110, in __getattr__
    value = self.__dict__["_attrs"][name]
KeyError: 'approval_rule_id'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/gitlab/base.py", line 130, in __getattr__
    return self.__dict__["_parent_attrs"][name]
KeyError: 'approval_rule_id'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/gitlab", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/dist-packages/gitlab/cli.py", line 362, in main
    gitlab.v4.cli.run(gl, what, action, args_dict, verbose, output, fields)
  File "/usr/local/lib/python3.9/dist-packages/gitlab/v4/cli.py", line 515, in run
    printer.display_list(data, fields, verbose=verbose)
  File "/usr/local/lib/python3.9/dist-packages/gitlab/v4/cli.py", line 483, in display_list
    self.display(get_dict(obj, fields), verbose=verbose, obj=obj)
  File "/usr/local/lib/python3.9/dist-packages/gitlab/v4/cli.py", line 461, in display
    id = getattr(obj, obj._id_attr)
  File "/usr/local/lib/python3.9/dist-packages/gitlab/base.py", line 146, in __getattr__
    raise AttributeError(message) from exc
AttributeError: 'ProjectMergeRequestApprovalRule' object has no attribute 'approval_rule_id'

<class 'gitlab.v4.objects.merge_request_approvals.ProjectMergeRequestA
pprovalRule'> was created via a list() call and only a subset of the
data may be present. To ensure all data is present get the object
using a get(object.id) call. For more details, see:

https://python-gitlab.readthedocs.io/en/v3.5.0/faq.html#attribute-error-list

Specifications

  • python-gitlab version: 3.5.0
  • API version you are using (v3/v4): not sure, the default one
  • Gitlab server version (or gitlab.com): 14.10

Activity

  1. JohnVillalovos commented on Jun 10, 2022

    Member

    My very quick initial guess is likely these two lines should be removed:

    _id_attr = "approval_rule_id"
    _repr_attr = "approval_rule"

    @nejch What do you think?

  2. added 6 commits that reference this issue on Jun 11, 2022
    a656629
    6945c56
    de2bd46
    35f1f61
    5f9d1dc
    ed3c342
  3. added a commit that references this issue on Jun 18, 2022
    15a242c
  4. locked as resolved and limited conversation to collaborators on Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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


      Back | FazBrowse Home | New Git URL