autoland: use the new treestatus url and structure (bug 1335735) r?mars draft
authorbyron jones <glob@mozilla.com>
Wed, 01 Feb 2017 23:32:19 +0800
changeset 10284 deb12c20392203edd0074a9fca9d12f44817f435
parent 10283 925b0d963e70870b1786d53d78d3fcf5f5c6a046
push id1504
push userbjones@mozilla.com
push dateWed, 01 Feb 2017 15:58:25 +0000
reviewersmars
bugs1335735
autoland: use the new treestatus url and structure (bug 1335735) r?mars The old treestatus URL no longer works, and the JSON result has slightly changed in structure. MozReview-Commit-ID: HTnqU9UhZ9v
autoland/autoland/treestatus.py
--- a/autoland/autoland/treestatus.py
+++ b/autoland/autoland/treestatus.py
@@ -1,30 +1,30 @@
 import config
 import re
 import requests
 
-TREESTATUS_URL = 'https://treestatus.mozilla.org/'
+TREESTATUS_URL = 'https://treestatus.mozilla-releng.net/trees/'
 
 
 def tree_is_open(logger, tree):
     treestatus_url = TREESTATUS_URL
     if config.testing():
         treestatus_url = 'http://treestatus/'
 
     # Map integration branches to their short form name
     m = re.match('ssh://hg\.mozilla\.org/integration/([^/]+)', tree)
     if m and m.groups():
         tree = m.groups()[0]
 
     r = None
     try:
-        r = requests.get(treestatus_url + tree + '?format=json', verify=False)
+        r = requests.get(treestatus_url + tree, verify=False)
         if r.status_code == 200:
-            return r.json()['status'] == 'open'
+            return r.json()['result']['status'] == 'open'
         elif r.status_code == 404:
             # We assume unrecognized trees are open
             return True
         else:
             logger.error('Unexpected response from treestatus API '
                          'for tree "%s": %s' % (tree, r.status_code))
     except KeyError:
         logger.error('Malformed response from treestatus API '