mozreview: reject autoland requests for disabled repositories (bug 1243530) r?mdoglio draft
authorDan Minor <dminor@mozilla.com>
Thu, 11 Feb 2016 15:29:17 -0500
changeset 7258 59ef8c812574dc30e591812dcd471e312703ef97
parent 7257 7652953040b03dd1a4868fc4c8edaa0a729f2c6e
child 7259 18150ad055defda524f944aaaa6ff88bb5da49bd
child 7267 6a3bdf4081d3e4e6de5b57cf8495833abd422d6f
push id640
push userdminor@mozilla.com
push dateTue, 16 Feb 2016 14:37:29 +0000
reviewersmdoglio
bugs1243530
mozreview: reject autoland requests for disabled repositories (bug 1243530) r?mdoglio MozReview-Commit-ID: 1zTsh1lM2Rx
pylib/mozreview/mozreview/autoland/resources.py
--- a/pylib/mozreview/mozreview/autoland/resources.py
+++ b/pylib/mozreview/mozreview/autoland/resources.py
@@ -140,16 +140,21 @@ class AutolandTriggerResource(BaseAutola
         commit_data = fetch_commit_data(rr)
 
         if not is_pushed(rr, commit_data) or not is_parent(rr, commit_data):
             logger.error('Failed triggering Autoland because the review '
                          'request is not pushed, or not the parent review '
                          'request.')
             return NOT_PUSHED_PARENT_REVIEW_REQUEST
 
+        enabled = rr.repository.extra_data.get('autolanding_enabled')
+        if not enabled:
+            return AUTOLAND_CONFIGURATION_ERROR.with_message(
+                'Autolanding not enabled.')
+
         target_repository = rr.repository.extra_data.get(
             'landing_repository_url')
         push_bookmark = rr.repository.extra_data.get('landing_bookmark')
 
         if not target_repository:
             return AUTOLAND_CONFIGURATION_ERROR.with_message(
                 'Autoland has not been configured with a proper landing URL.')
 
@@ -285,16 +290,21 @@ class TryAutolandTriggerResource(BaseAut
         commit_data = fetch_commit_data(rr)
 
         if not is_pushed(rr, commit_data) or not is_parent(rr, commit_data):
             logger.error('Failed triggering Autoland because the review '
                          'request is not pushed, or not the parent review '
                          'request.')
             return NOT_PUSHED_PARENT_REVIEW_REQUEST
 
+        enabled = rr.repository.extra_data.get('autolanding_to_try_enabled')
+        if not enabled:
+            return AUTOLAND_CONFIGURATION_ERROR.with_message(
+                'Autolanding to try not enabled.')
+
         target_repository = rr.repository.extra_data.get(
             'try_repository_url')
 
         if not target_repository:
             return AUTOLAND_CONFIGURATION_ERROR.with_message(
                 'Autoland has not been configured with a proper try URL.')
 
         last_revision = json.loads(