style-queue "AttributeError: 'NoneType' object has no attribute 'is_obsolete'" when...
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Jun 2018 23:43:13 +0000 (23:43 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Jun 2018 23:43:13 +0000 (23:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=187120

Reviewed by David Kilzer.

Teach the style queue how to refetch a patch from the status server as we did for non-Style
EWS queues.

* Scripts/webkitpy/tool/bot/stylequeuetask.py:
(StyleQueueTask.validate): Similar to change made to EarlyWarningSystemTask.validate() in r233107,
only check if the bug associated with the patch we are processing is closed if the attachment has a
non-None Bug object.
* Scripts/webkitpy/tool/commands/earlywarningsystem.py:
(AbstractEarlyWarningSystem.refetch_patch): Extract logic to refetch a patch from here...
* Scripts/webkitpy/tool/commands/queues.py:
(PatchProcessingQueue._refetch_patch): ... to here.
(StyleQueue.refetch_patch): Turn around and call PatchProcessingQueue._refetch_patch().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233288 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/tool/bot/stylequeuetask.py
Tools/Scripts/webkitpy/tool/commands/earlywarningsystem.py
Tools/Scripts/webkitpy/tool/commands/queues.py

index 61770ec..5c6c081 100644 (file)
@@ -1,3 +1,23 @@
+2018-06-27  Daniel Bates  <dabates@apple.com>
+
+        style-queue "AttributeError: 'NoneType' object has no attribute 'is_obsolete'" when processing security patch
+        https://bugs.webkit.org/show_bug.cgi?id=187120
+
+        Reviewed by David Kilzer.
+
+        Teach the style queue how to refetch a patch from the status server as we did for non-Style
+        EWS queues.
+
+        * Scripts/webkitpy/tool/bot/stylequeuetask.py:
+        (StyleQueueTask.validate): Similar to change made to EarlyWarningSystemTask.validate() in r233107,
+        only check if the bug associated with the patch we are processing is closed if the attachment has a
+        non-None Bug object.
+        * Scripts/webkitpy/tool/commands/earlywarningsystem.py:
+        (AbstractEarlyWarningSystem.refetch_patch): Extract logic to refetch a patch from here...
+        * Scripts/webkitpy/tool/commands/queues.py:
+        (PatchProcessingQueue._refetch_patch): ... to here.
+        (StyleQueue.refetch_patch): Turn around and call PatchProcessingQueue._refetch_patch().
+
 2018-06-27  Tadeu Zagallo  <tzagallo@apple.com>
 
         Unreviewed, add myself as a WebKit committer.
index 85ede07..eac7238 100644 (file)
@@ -36,11 +36,15 @@ class StyleQueueTaskDelegate(PatchAnalysisTaskDelegate):
 
 class StyleQueueTask(PatchAnalysisTask):
     def validate(self):
+        # FIXME: Need a way to ask the status server for the latest status of a security bug.
+        # Attachments downloaded from the status server do not have an associated bug and
+        # reflect the Bugzilla state at the time they were uploaded to the status server.
+        # See <https://bugs.webkit.org/show_bug.cgi?id=186817>.
         self._patch = self._delegate.refetch_patch(self._patch)
         if self._patch.is_obsolete():
             self.error = "Patch is obsolete."
             return False
-        if self._patch.bug().is_closed():
+        if self._patch.bug() and self._patch.bug().is_closed():
             self.error = "Bug is already closed."
             return False
         if self._patch.review() == "-":
index 74ffe8e..6bb6be2 100644 (file)
@@ -34,7 +34,6 @@ from optparse import make_option
 
 from webkitpy.common.config.committers import CommitterList
 from webkitpy.common.config.ports import DeprecatedPort
-from webkitpy.common.net.bugzilla import Bugzilla
 from webkitpy.common.system.filesystem import FileSystem
 from webkitpy.common.system.executive import ScriptError
 from webkitpy.tool.bot.earlywarningsystemtask import EarlyWarningSystemTask, EarlyWarningSystemTaskDelegate
@@ -153,16 +152,7 @@ class AbstractEarlyWarningSystem(AbstractReviewQueue, EarlyWarningSystemTaskDele
         return self._group
 
     def refetch_patch(self, patch):
-        patch_id = patch.id()
-        try:
-            patch = self._tool.bugs.fetch_attachment(patch_id, throw_on_access_error=True)
-        except Bugzilla.AccessError as e:
-            # FIXME: Need a way to ask the status server to fetch the patch again. For now
-            # we return the attachment as it was when it was originally uploaded to the
-            # status server. See <https://bugs.webkit.org/show_bug.cgi?id=186817>.
-            if e.error_code == Bugzilla.AccessError.NOT_PERMITTED:
-                patch = self._tool.status_server.fetch_attachment(patch_id)
-        return patch
+        return super(AbstractEarlyWarningSystem, self)._refetch_patch(patch)
 
     def report_flaky_tests(self, patch, flaky_test_results, results_archive):
         pass
index 2b33f98..7fd2430 100644 (file)
@@ -328,6 +328,18 @@ class PatchProcessingQueue(AbstractPatchQueue):
         if self._can_access_bug(patch.bug_id()):
             self._tool.bugs.add_attachment_to_bug(patch.bug_id(), results_archive_file, description, filename="layout-test-results.zip", comment_text=comment_text)
 
+    def _refetch_patch(self, patch):
+        patch_id = patch.id()
+        try:
+            patch = self._tool.bugs.fetch_attachment(patch_id, throw_on_access_error=True)
+        except Bugzilla.AccessError as e:
+            # FIXME: Need a way to ask the status server to fetch the patch again. For now
+            # we return the attachment as it was when it was originally uploaded to the
+            # status server. See <https://bugs.webkit.org/show_bug.cgi?id=186817>.
+            if e.error_code == Bugzilla.AccessError.NOT_PERMITTED:
+                patch = self._tool.status_server.fetch_attachment(patch_id)
+        return patch
+
 
 class CommitQueue(PatchProcessingQueue, StepSequenceErrorHandler, CommitQueueTaskDelegate):
     def __init__(self, commit_queue_task_class=CommitQueueTask):
@@ -523,4 +535,4 @@ class StyleQueue(AbstractReviewQueue, StyleQueueTaskDelegate):
         return None
 
     def refetch_patch(self, patch):
-        return self._tool.bugs.fetch_attachment(patch.id())
+        return super(StyleQueue, self)._refetch_patch(patch)