You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/usr/bin/env python3importgitlabimportosgl=gitlab.Gitlab('https://gitlab.com', private_token=os.environ['GITLAB_TOKEN'])
gl.auth()
# Load a gitlab groupgroup_id=123456# TODO use an existing group_id heregitlab_group=gl.groups.get(group_id)
# show the request_access_enabled -> that call is OKprint('request_access_enabled', gitlab_group.request_access_enabled)
# show the membership_lock -> that call is NOT OKprint('membership_lock', gitlab_group.membership_lock)
# show the shared_runners_setting -> that call is NOT OKprint('shared_runners_setting', gitlab_group.shared_runners_setting)
The membership_lock attribute seems to be implemented, but the shared_runners_setting does not appear at all.
Having the ability to read and/or update the membership_lock and shared_runners_setting attributes of GitLab groups.
Actual Behavior
Actually when I try to read the membership_lock or shared_runners_setting, I get a AttributeError
request_access_enabled False # <- the first call that works
Traceback (most recent call last):
File "/home/speyssard/.local/lib/python3.6/site-packages/gitlab/base.py", line 77, in __getattr__
return self.__dict__["_updated_attrs"][name]
KeyError: 'membership_lock'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/speyssard/.local/lib/python3.6/site-packages/gitlab/base.py", line 80, in __getattr__
value = self.__dict__["_attrs"][name]
KeyError: 'membership_lock'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/speyssard/.local/lib/python3.6/site-packages/gitlab/base.py", line 100, in __getattr__
return self.__dict__["_parent_attrs"][name]
KeyError: 'membership_lock'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 16, in <module>
print('membership_lock', gitlab_group.membership_lock)
File "/home/speyssard/.local/lib/python3.6/site-packages/gitlab/base.py", line 102, in __getattr__
raise AttributeError(name)
AttributeError: membership_lock
Specifications
python-gitlab version: 2.7.1 (and 2.5.0)
API version you are using (v3/v4): v4
Gitlab server version (or gitlab.com): 13.9.4-ee (not tested on gitlab.com but on a private gitlab server)
The text was updated successfully, but these errors were encountered:
Hi @Stan0304, the get() calls return whatever the GitLab server returns.
In your case, membership_lock and shared_runners_setting are only available as a parameter for the POST and PUT request (create or update group), not for GET, at least according to https://docs.gitlab.com/ee/api/groups.html. You can verify this with a curl GT request, it will likely not show up in the json either.
This seems like an oversight in the GitLab's API, so I suggest you open an issue upstream and link it here https://gitlab.com/gitlab-org/gitlab.
It's true the shared_runners_setting is not in our list (so I'll keep this open) but that is mostly used for the CLI, if you pass the params as a dict to the update() or create() methods you should be able to use the params already. You will just not be able to later retrieve them via get().
That's right ! membership_lock does not appear for the GET. I did update membership_lock successfuly (as long as I do not try to read it first).
Thanks !
Description of the problem, including code/CLI snippet
I tried to update a GitLab group and I can't update or even read the following attributes even if those settings exists on the API side (https://docs.gitlab.com/ee/api/groups.html#update-group):
Bellow the code to reproduce the error.
The
membership_lock
attribute seems to be implemented, but theshared_runners_setting
does not appear at all.Expected Behavior
Having the ability to read and/or update the
membership_lock
andshared_runners_setting
attributes of GitLab groups.Actual Behavior
Actually when I try to read the
membership_lock
orshared_runners_setting
, I get aAttributeError
Specifications
The text was updated successfully, but these errors were encountered: