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

Commit2ce81e7

Browse files
committed
Don't expect commit_id for PullReview
In some cases, a PullReview may not have a commit_id (I am not sure whythat is). In this case, we should not always expect it to be there. 2019-05-30 21:20:25,678 ERROR zuul.GithubEventConnector: Exception moving GitHub event: Traceback (most recent call last): File "/opt/venv/zuul-3.8.1/lib/python3.6/site-packages/github3/models.py", line 48, in __init__ self._update_attributes(json) File "/opt/venv/zuul-3.8.1/lib/python3.6/site-packages/github3/pulls.py", line 961, in _update_attributes self.commit_id = review["commit_id"] KeyError: 'commit_id' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/venv/zuul-3.8.1/lib/python3.6/site-packages/zuul/driver/github/githubconnection.py", line 484, in run GithubEventProcessor(self, data).run() File "/opt/venv/zuul-3.8.1/lib/python3.6/site-packages/zuul/driver/github/githubconnection.py", line 218, in run self._handle_event() File "/opt/venv/zuul-3.8.1/lib/python3.6/site-packages/zuul/driver/github/githubconnection.py", line 265, in _handle_event refresh=True) File "/opt/venv/zuul-3.8.1/lib/python3.6/site-packages/zuul/driver/github/githubconnection.py", line 903, in _getChange self._updateChange(change) File "/opt/venv/zuul-3.8.1/lib/python3.6/site-packages/zuul/driver/github/githubconnection.py", line 1008, in _updateChange change.number) File "/opt/venv/zuul-3.8.1/lib/python3.6/site-packages/zuul/driver/github/githubconnection.py", line 1246, in getPullReviews revs = [review.as_dict() for review in pr_obj.reviews()] File "/opt/venv/zuul-3.8.1/lib/python3.6/site-packages/zuul/driver/github/githubconnection.py", line 1246, in <listcomp> revs = [review.as_dict() for review in pr_obj.reviews()] File "/opt/venv/zuul-3.8.1/lib/python3.6/site-packages/github3/structs.py", line 122, in __iter__ yield cls(i) File "/opt/venv/zuul-3.8.1/lib/python3.6/site-packages/github3/models.py", line 50, in __init__ raise exceptions.IncompleteResponse(json, kerr) github3.exceptions.IncompleteResponse: None The library was expecting more data in the response (KeyError('commit_id',)). Either GitHub modified it's response body, or your token is not prop erly scoped to retrieve this information.https://api.github.com/repos/ansible/ansible/pulls/45469/reviewsSigned-off-by: Paul Belanger <pabelanger@redhat.com>
1 parentdb1f7e7 commit2ce81e7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎src/github3/pulls.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,12 @@ class PullReview(models.GitHubCore):
926926
927927
The SHA of the commit that the review was left on.
928928
929+
.. note::
930+
931+
It is possible for the attribute to be set to ``None``, if the
932+
review references a commit that is no longer available in the pull
933+
request branch, such as after a force push.
934+
929935
.. attribute:: html_url
930936
931937
.. versionadded:: 1.0.0
@@ -958,7 +964,9 @@ def _update_attributes(self, review):
958964
self.body=review["body"]
959965
self.body_html=review["body_html"]
960966
self.body_text=review["body_text"]
961-
self.commit_id=review["commit_id"]
967+
# NOTE(pabelanger): In some cases, commit_id could be missing on a
968+
# PullReview.
969+
self.commit_id=review.get("commit_id",None)
962970
self.html_url=review["html_url"]
963971
self.user=users.ShortUser(review["user"],self)
964972
self.state=review["state"]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp