mozreview: reject autoland requests for disabled repositories (
bug 1243530) r?mdoglio
MozReview-Commit-ID: 1zTsh1lM2Rx
--- 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(