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

Project Push Rules not returning response #2990

Closed as not planned
Closed as not planned
Labels
@calnighters

Description

@calnighters

Description of the problem, including code/CLI snippet

When calling the gitlab API to get a projects push rules after looping over a list of projects, the API will fail at projects that havent been pre-looked at in the UI. I am able to manually call the URL using the .http_get method and it returns None as expected. Once I have viewed the push rules in the UI for a project, then the call is successful and it moves on to the next project where this will happen again.

try:root_group=gl.groups.get(ROOT_GROUP_ID)exceptgitlab.exceptions.GitlabGetError:sys.exit(f"Group '{ROOT_GROUP_ID}' does not exist.")groups= [root_group]groups.extend([gl.groups.get(gr.id)forgrinroot_group.descendant_groups.list(get_all=True)])projects= [gl.projects.get(gr.id)forgrinroot_group.projects.list(include_subgroups=True,get_all=True)]defpush_rules_update(entity,full_path):push_rules_config,config_name=find_config(full_path,'push_rules')print(f"Updating '{entity.id} -{full_path}' with '{config_name} push_rules'")pr=Nonetry:pr=entity.pushrules.get()exceptgitlab.exceptions.GitlabGetError:passifprisNone:entity.pushrules.create(push_rules_config)else:forkey,valueinpush_rules_config.items():setattr(pr,key,value)pr.save()print(f"Updated '{entity.id} -{full_path}' with '{config_name} push_rules'")defapproval_rules_update(entity,full_path):ifisinstance(entity,gitlab.v4.objects.Project):print(entity)defupdate(entity,full_path):push_rules_update(entity,full_path)# approval_rules_update(entity, full_path)# for group in groups:#     update(group, group.full_path)gl.enable_debug()push_rule=gl.http_get('/projects/14756/push_rule')print(push_rule)forprojectinprojects:update(project,project.path_with_namespace)

Expected Behavior

Be able to view project push rules without navigating to them in the UI first.

Actual Behavior

Unable to view project push rules without navigating to them in the Ui first.

Specifications

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

Please see below logs which show the successful manual call at the top to the same project which fails at the bottom.

DEBUG:http.client:send: b'GET /api/v4/projects/14756/push_rule HTTP/1.1\r\nHost: REVOKED\r\nUser-Agent: python-gitlab/4.11.1\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nContent-type: application/json\r\nPRIVATE-TOKEN: [MASKED]\r\n\r\n'DEBUG:http.client:reply: 'HTTP/1.1 200 OK\r\n'DEBUG:http.client:header: Date: Fri, 20 Sep 2024 15:04:27 GMTDEBUG:http.client:header: Content-Type: application/jsonDEBUG:http.client:header: Content-Length: 4DEBUG:http.client:header: Connection: keep-aliveDEBUG:http.client:header: Server: nginxDEBUG:http.client:header: Cache-Control: max-age=0, private, must-revalidateDEBUG:http.client:header: Etag: W/"74234e98afe7498fb5daf1f36ac2d78a"DEBUG:http.client:header: Vary: OriginDEBUG:http.client:header: X-Content-Type-Options: nosniffDEBUG:http.client:header: X-Frame-Options: SAMEORIGINDEBUG:http.client:header: X-Gitlab-Meta: {"correlation_id":"01J87ZD13M8950KYFPRB1RXKEB","version":"1"}DEBUG:http.client:header: X-Request-Id: 01J87ZD13M8950KYFPRB1RXKEBDEBUG:http.client:header: X-Runtime: 0.071143DEBUG:http.client:header: Strict-Transport-Security: max-age=31536000; includeSubdomainsDEBUG:http.client:header: Referrer-Policy: same-originDEBUG:urllib3.connectionpool:https://REVOKED:443 "GET /api/v4/projects/14756/push_rule HTTP/11" 200 4NoneUpdating '16741 - tact/public/gitlab/gitlab-repo-updater' with 'tact push_rules'DEBUG:http.client:send: b'GET /api/v4/projects/16741/push_rule HTTP/1.1\r\nHost: REVOKED\r\nUser-Agent: python-gitlab/4.11.1\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nContent-type: application/json\r\nPRIVATE-TOKEN: [MASKED]\r\n\r\n'DEBUG:http.client:reply: 'HTTP/1.1 200 OK\r\n'DEBUG:http.client:header: Date: Fri, 20 Sep 2024 15:04:27 GMTDEBUG:http.client:header: Content-Type: application/jsonDEBUG:http.client:header: Transfer-Encoding: chunkedDEBUG:http.client:header: Connection: keep-aliveDEBUG:http.client:header: Server: nginxDEBUG:http.client:header: Vary: Accept-EncodingDEBUG:http.client:header: Cache-Control: max-age=0, private, must-revalidateDEBUG:http.client:header: Etag: W/"8bf014cf030396a6e72a556569dba651"DEBUG:http.client:header: Vary: OriginDEBUG:http.client:header: X-Content-Type-Options: nosniffDEBUG:http.client:header: X-Frame-Options: SAMEORIGINDEBUG:http.client:header: X-Gitlab-Meta: {"correlation_id":"01J87ZD1621Y2E85ZF8KQFKP1E","version":"1"}DEBUG:http.client:header: X-Request-Id: 01J87ZD1621Y2E85ZF8KQFKP1EDEBUG:http.client:header: X-Runtime: 0.081929DEBUG:http.client:header: Strict-Transport-Security: max-age=31536000; includeSubdomainsDEBUG:http.client:header: Referrer-Policy: same-originDEBUG:http.client:header: Content-Encoding: gzipDEBUG:urllib3.connectionpool:https://REVOKED:443 "GET /api/v4/projects/16741/push_rule HTTP/11" 200 NoneDEBUG:http.client:send: b'PUT /api/v4/projects/16741/push_rule HTTP/1.1\r\nHost: REVOKED\r\nUser-Agent: python-gitlab/4.11.1\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nContent-type: application/json\r\nContent-Length: 57\r\nPRIVATE-TOKEN: [MASKED]\r\n\r\n'DEBUG:http.client:send: b'{"commit_message_regex": ".*", "branch_name_regex": ".*"}'DEBUG:http.client:reply: 'HTTP/1.1 200 OK\r\n'DEBUG:http.client:header: Date: Fri, 20 Sep 2024 15:04:27 GMTDEBUG:http.client:header: Content-Type: application/jsonDEBUG:http.client:header: Transfer-Encoding: chunkedDEBUG:http.client:header: Connection: keep-aliveDEBUG:http.client:header: Server: nginxDEBUG:http.client:header: Vary: Accept-EncodingDEBUG:http.client:header: Cache-Control: max-age=0, private, must-revalidateDEBUG:http.client:header: Etag: W/"8bf014cf030396a6e72a556569dba651"DEBUG:http.client:header: Vary: OriginDEBUG:http.client:header: X-Content-Type-Options: nosniffDEBUG:http.client:header: X-Frame-Options: SAMEORIGINDEBUG:http.client:header: X-Gitlab-Meta: {"correlation_id":"01J87ZD18VZHQZ9ZK2E8BAKAQW","version":"1"}DEBUG:http.client:header: X-Request-Id: 01J87ZD18VZHQZ9ZK2E8BAKAQWDEBUG:http.client:header: X-Runtime: 0.093720DEBUG:http.client:header: Strict-Transport-Security: max-age=31536000; includeSubdomainsDEBUG:http.client:header: Referrer-Policy: same-originDEBUG:http.client:header: Content-Encoding: gzipDEBUG:urllib3.connectionpool:https://REVOKED:443 "PUT /api/v4/projects/16741/push_rule HTTP/11" 200 NoneUpdated '16741 - tact/public/gitlab/gitlab-repo-updater' with 'tact push_rules'Updating '16063 - tact/public/argocd/argocd-keycloak-auth' with 'tact push_rules'DEBUG:http.client:send: b'GET /api/v4/projects/16063/push_rule HTTP/1.1\r\nHost: REVOKED\r\nUser-Agent: python-gitlab/4.11.1\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nContent-type: application/json\r\nPRIVATE-TOKEN: [MASKED]\r\n\r\n'DEBUG:http.client:reply: 'HTTP/1.1 200 OK\r\n'DEBUG:http.client:header: Date: Fri, 20 Sep 2024 15:04:27 GMTDEBUG:http.client:header: Content-Type: application/jsonDEBUG:http.client:header: Transfer-Encoding: chunkedDEBUG:http.client:header: Connection: keep-aliveDEBUG:http.client:header: Server: nginxDEBUG:http.client:header: Vary: Accept-EncodingDEBUG:http.client:header: Cache-Control: max-age=0, private, must-revalidateDEBUG:http.client:header: Etag: W/"094a0aa47dff6be0c2ab86ffd1077d10"DEBUG:http.client:header: Vary: OriginDEBUG:http.client:header: X-Content-Type-Options: nosniffDEBUG:http.client:header: X-Frame-Options: SAMEORIGINDEBUG:http.client:header: X-Gitlab-Meta: {"correlation_id":"01J87ZD1BZJKYDXH257G949PN3","version":"1"}DEBUG:http.client:header: X-Request-Id: 01J87ZD1BZJKYDXH257G949PN3DEBUG:http.client:header: X-Runtime: 0.089399DEBUG:http.client:header: Strict-Transport-Security: max-age=31536000; includeSubdomainsDEBUG:http.client:header: Referrer-Policy: same-originDEBUG:http.client:header: Content-Encoding: gzipDEBUG:urllib3.connectionpool:https://REVOKED:443 "GET /api/v4/projects/16063/push_rule HTTP/11" 200 NoneDEBUG:http.client:send: b'PUT /api/v4/projects/16063/push_rule HTTP/1.1\r\nHost: REVOKED\r\nUser-Agent: python-gitlab/4.11.1\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nContent-type: application/json\r\nContent-Length: 57\r\nPRIVATE-TOKEN: [MASKED]\r\n\r\n'DEBUG:http.client:send: b'{"commit_message_regex": ".*", "branch_name_regex": ".*"}'DEBUG:http.client:reply: 'HTTP/1.1 200 OK\r\n'DEBUG:http.client:header: Date: Fri, 20 Sep 2024 15:04:27 GMTDEBUG:http.client:header: Content-Type: application/jsonDEBUG:http.client:header: Transfer-Encoding: chunkedDEBUG:http.client:header: Connection: keep-aliveDEBUG:http.client:header: Server: nginxDEBUG:http.client:header: Vary: Accept-EncodingDEBUG:http.client:header: Cache-Control: max-age=0, private, must-revalidateDEBUG:http.client:header: Etag: W/"094a0aa47dff6be0c2ab86ffd1077d10"DEBUG:http.client:header: Vary: OriginDEBUG:http.client:header: X-Content-Type-Options: nosniffDEBUG:http.client:header: X-Frame-Options: SAMEORIGINDEBUG:http.client:header: X-Gitlab-Meta: {"correlation_id":"01J87ZD1EZQAM237N53FP1044J","version":"1"}DEBUG:http.client:header: X-Request-Id: 01J87ZD1EZQAM237N53FP1044JDEBUG:http.client:header: X-Runtime: 0.079044DEBUG:http.client:header: Strict-Transport-Security: max-age=31536000; includeSubdomainsDEBUG:http.client:header: Referrer-Policy: same-originDEBUG:http.client:header: Content-Encoding: gzipDEBUG:urllib3.connectionpool:https://REVOKED:443 "PUT /api/v4/projects/16063/push_rule HTTP/11" 200 NoneUpdated '16063 - tact/public/argocd/argocd-keycloak-auth' with 'tact push_rules'Updating '15681 - tact/public/gitlab-profile' with 'tact push_rules'DEBUG:http.client:send: b'GET /api/v4/projects/15681/push_rule HTTP/1.1\r\nHost: REVOKED\r\nUser-Agent: python-gitlab/4.11.1\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nContent-type: application/json\r\nPRIVATE-TOKEN: [MASKED]\r\n\r\n'DEBUG:http.client:reply: 'HTTP/1.1 200 OK\r\n'DEBUG:http.client:header: Date: Fri, 20 Sep 2024 15:04:27 GMTDEBUG:http.client:header: Content-Type: application/jsonDEBUG:http.client:header: Transfer-Encoding: chunkedDEBUG:http.client:header: Connection: keep-aliveDEBUG:http.client:header: Server: nginxDEBUG:http.client:header: Vary: Accept-EncodingDEBUG:http.client:header: Cache-Control: max-age=0, private, must-revalidateDEBUG:http.client:header: Etag: W/"7e4d121807009c9b06ce1f6bd637e8c6"DEBUG:http.client:header: Vary: OriginDEBUG:http.client:header: X-Content-Type-Options: nosniffDEBUG:http.client:header: X-Frame-Options: SAMEORIGINDEBUG:http.client:header: X-Gitlab-Meta: {"correlation_id":"01J87ZD1HMTKWY7VVJF0Y6DBGJ","version":"1"}DEBUG:http.client:header: X-Request-Id: 01J87ZD1HMTKWY7VVJF0Y6DBGJDEBUG:http.client:header: X-Runtime: 0.090885DEBUG:http.client:header: Strict-Transport-Security: max-age=31536000; includeSubdomainsDEBUG:http.client:header: Referrer-Policy: same-originDEBUG:http.client:header: Content-Encoding: gzipDEBUG:urllib3.connectionpool:https://REVOKED:443 "GET /api/v4/projects/15681/push_rule HTTP/11" 200 NoneDEBUG:http.client:send: b'PUT /api/v4/projects/15681/push_rule HTTP/1.1\r\nHost: REVOKED\r\nUser-Agent: python-gitlab/4.11.1\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nContent-type: application/json\r\nContent-Length: 57\r\nPRIVATE-TOKEN: [MASKED]\r\n\r\n'DEBUG:http.client:send: b'{"commit_message_regex": ".*", "branch_name_regex": ".*"}'DEBUG:http.client:reply: 'HTTP/1.1 200 OK\r\n'DEBUG:http.client:header: Date: Fri, 20 Sep 2024 15:04:27 GMTDEBUG:http.client:header: Content-Type: application/jsonDEBUG:http.client:header: Transfer-Encoding: chunkedDEBUG:http.client:header: Connection: keep-aliveDEBUG:http.client:header: Server: nginxDEBUG:http.client:header: Vary: Accept-EncodingDEBUG:http.client:header: Cache-Control: max-age=0, private, must-revalidateDEBUG:http.client:header: Etag: W/"7e4d121807009c9b06ce1f6bd637e8c6"DEBUG:http.client:header: Vary: OriginDEBUG:http.client:header: X-Content-Type-Options: nosniffDEBUG:http.client:header: X-Frame-Options: SAMEORIGINDEBUG:http.client:header: X-Gitlab-Meta: {"correlation_id":"01J87ZD1MP2G48FV3DC01P6MNM","version":"1"}DEBUG:http.client:header: X-Request-Id: 01J87ZD1MP2G48FV3DC01P6MNMDEBUG:http.client:header: X-Runtime: 0.122944DEBUG:http.client:header: Strict-Transport-Security: max-age=31536000; includeSubdomainsDEBUG:http.client:header: Referrer-Policy: same-originDEBUG:http.client:header: Content-Encoding: gzipDEBUG:urllib3.connectionpool:https://REVOKED:443 "PUT /api/v4/projects/15681/push_rule HTTP/11" 200 NoneUpdated '15681 - tact/public/gitlab-profile' with 'tact push_rules'Updating '15536 - tact/public/argocd/argocd-helm-chart' with 'tact push_rules'DEBUG:http.client:send: b'GET /api/v4/projects/15536/push_rule HTTP/1.1\r\nHost: REVOKED\r\nUser-Agent: python-gitlab/4.11.1\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nContent-type: application/json\r\nPRIVATE-TOKEN: [MASKED]\r\n\r\n'DEBUG:http.client:reply: 'HTTP/1.1 200 OK\r\n'DEBUG:http.client:header: Date: Fri, 20 Sep 2024 15:04:28 GMTDEBUG:http.client:header: Content-Type: application/jsonDEBUG:http.client:header: Transfer-Encoding: chunkedDEBUG:http.client:header: Connection: keep-aliveDEBUG:http.client:header: Server: nginxDEBUG:http.client:header: Vary: Accept-EncodingDEBUG:http.client:header: Cache-Control: max-age=0, private, must-revalidateDEBUG:http.client:header: Etag: W/"7218ebd650220722b291064ff0e9f020"DEBUG:http.client:header: Vary: OriginDEBUG:http.client:header: X-Content-Type-Options: nosniffDEBUG:http.client:header: X-Frame-Options: SAMEORIGINDEBUG:http.client:header: X-Gitlab-Meta: {"correlation_id":"01J87ZD1S0KB8WSX0NWQEQ538Z","version":"1"}DEBUG:http.client:header: X-Request-Id: 01J87ZD1S0KB8WSX0NWQEQ538ZDEBUG:http.client:header: X-Runtime: 0.097663DEBUG:http.client:header: Strict-Transport-Security: max-age=31536000; includeSubdomainsDEBUG:http.client:header: Referrer-Policy: same-originDEBUG:http.client:header: Content-Encoding: gzipDEBUG:urllib3.connectionpool:https://REVOKED:443 "GET /api/v4/projects/15536/push_rule HTTP/11" 200 NoneDEBUG:http.client:send: b'PUT /api/v4/projects/15536/push_rule HTTP/1.1\r\nHost: REVOKED\r\nUser-Agent: python-gitlab/4.11.1\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nContent-type: application/json\r\nContent-Length: 57\r\nPRIVATE-TOKEN: [MASKED]\r\n\r\n'DEBUG:http.client:send: b'{"commit_message_regex": ".*", "branch_name_regex": ".*"}'DEBUG:http.client:reply: 'HTTP/1.1 200 OK\r\n'DEBUG:http.client:header: Date: Fri, 20 Sep 2024 15:04:28 GMTDEBUG:http.client:header: Content-Type: application/jsonDEBUG:http.client:header: Transfer-Encoding: chunkedDEBUG:http.client:header: Connection: keep-aliveDEBUG:http.client:header: Server: nginxDEBUG:http.client:header: Vary: Accept-EncodingDEBUG:http.client:header: Cache-Control: max-age=0, private, must-revalidateDEBUG:http.client:header: Etag: W/"7218ebd650220722b291064ff0e9f020"DEBUG:http.client:header: Vary: OriginDEBUG:http.client:header: X-Content-Type-Options: nosniffDEBUG:http.client:header: X-Frame-Options: SAMEORIGINDEBUG:http.client:header: X-Gitlab-Meta: {"correlation_id":"01J87ZD1W8WZ55M3P0G0Z15GR2","version":"1"}DEBUG:http.client:header: X-Request-Id: 01J87ZD1W8WZ55M3P0G0Z15GR2DEBUG:http.client:header: X-Runtime: 0.077882DEBUG:http.client:header: Strict-Transport-Security: max-age=31536000; includeSubdomainsDEBUG:http.client:header: Referrer-Policy: same-originDEBUG:http.client:header: Content-Encoding: gzipDEBUG:urllib3.connectionpool:https://REVOKED:443 "PUT /api/v4/projects/15536/push_rule HTTP/11" 200 NoneUpdated '15536 - tact/public/argocd/argocd-helm-chart' with 'tact push_rules'Updating '14756 - tact/public/gitlab/gitlab-pipelines' with 'tact push_rules'DEBUG:http.client:send: b'GET /api/v4/projects/14756/push_rule HTTP/1.1\r\nHost: REVOKED\r\nUser-Agent: python-gitlab/4.11.1\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nContent-type: application/json\r\nPRIVATE-TOKEN: [MASKED]\r\n\r\n'DEBUG:http.client:reply: 'HTTP/1.1 200 OK\r\n'DEBUG:http.client:header: Date: Fri, 20 Sep 2024 15:04:28 GMTDEBUG:http.client:header: Content-Type: application/jsonDEBUG:http.client:header: Content-Length: 4DEBUG:http.client:header: Connection: keep-aliveDEBUG:http.client:header: Server: nginxDEBUG:http.client:header: Cache-Control: max-age=0, private, must-revalidateDEBUG:http.client:header: Etag: W/"74234e98afe7498fb5daf1f36ac2d78a"DEBUG:http.client:header: Vary: OriginDEBUG:http.client:header: X-Content-Type-Options: nosniffDEBUG:http.client:header: X-Frame-Options: SAMEORIGINDEBUG:http.client:header: X-Gitlab-Meta: {"correlation_id":"01J87ZD1YXNBM5TQWPGP3NYWT6","version":"1"}DEBUG:http.client:header: X-Request-Id: 01J87ZD1YXNBM5TQWPGP3NYWT6DEBUG:http.client:header: X-Runtime: 0.062822DEBUG:http.client:header: Strict-Transport-Security: max-age=31536000; includeSubdomainsDEBUG:http.client:header: Referrer-Policy: same-originDEBUG:urllib3.connectionpool:https://REVOKED:443 "GET /api/v4/projects/14756/push_rule HTTP/11" 200 4Traceback (most recent call last):  File "/home/u.7843152-3/gitlab-repo-updater/configure.py", line 95, in <module>    update(project, project.path_with_namespace)  File "/home/u.7843152-3/gitlab-repo-updater/configure.py", line 85, in update    push_rules_update(entity, full_path)  File "/home/u.7843152-3/gitlab-repo-updater/configure.py", line 69, in push_rules_update    pr = entity.pushrules.get()         ^^^^^^^^^^^^^^^^^^^^^^  File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.3/lib/python3.12/site-packages/gitlab/v4/objects/push_rules.py", line 64, in get    return cast(ProjectPushRules, super().get(**kwargs))                                  ^^^^^^^^^^^^^^^^^^^^^  File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.3/lib/python3.12/site-packages/gitlab/exceptions.py", line 344, in wrapped_f    return f(*args, **kwargs)           ^^^^^^^^^^^^^^^^^^  File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.3/lib/python3.12/site-packages/gitlab/mixins.py", line 159, in get    return self._obj_cls(self, server_data)           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "/home/linuxbrew/.linuxbrew/Cellar/python@3.12/3.12.3/lib/python3.12/site-packages/gitlab/base.py", line 62, in __init__    raise GitlabParsingError(gitlab.exceptions.GitlabParsingError: Attempted to initialize RESTObject with a non-dictionary value: NoneThis likely indicates an incorrect or malformed server response.

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