testing: Set mozreview_app_id in BMO params (bug 1237491). r?smacleod draft
authorMark Cote <mcote@mozilla.com>
Fri, 04 Mar 2016 11:59:56 -0500
changeset 7520 33c7af66b068439328d0b66cecfe97f0f9a5ef10
parent 7519 1bb1d8c8974edb4f324824b2fff0f6bd8ddf5be7
child 7521 415fadef62d44b97df92d3445aec65b00b625a2e
push id700
push usermcote@mozilla.com
push dateFri, 18 Mar 2016 00:41:48 +0000
reviewerssmacleod
bugs1237491
testing: Set mozreview_app_id in BMO params (bug 1237491). r?smacleod MozReview-Commit-ID: BKSkEGHQawm
testing/docker/builder-bmoweb/set-urls
--- a/testing/docker/builder-bmoweb/set-urls
+++ b/testing/docker/builder-bmoweb/set-urls
@@ -1,31 +1,38 @@
 #!/usr/bin/python2.7
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import print_function, unicode_literals
 
-import os
+import hashlib
 import sys
 
 import psutil
 
 pf = '/var/lib/bugzilla/bugzilla/data/params'
 
-rburl = sys.argv[1]
+mr_url = sys.argv[1]
+mr_cb_url = '%smozreview/bmo_auth_callback/' % mr_url
+
+# MozReview app ID is the SHA of the callback URL + key description
+# ("mozreview").  This is needed to use MozReview-specific BMO APIs.
+mr_app_id = hashlib.sha256('%smozreview' % mr_cb_url).hexdigest()
 
 params_lines = open(pf, 'r').readlines()
 with open(pf, 'w') as fh:
     for line in params_lines:
         if "'mozreview_base_url' =>" in line:
-            line = "           'mozreview_base_url' => '%s',\n" % rburl
+            line = "           'mozreview_base_url' => '%s',\n" % mr_url
         elif "'mozreview_auth_callback_url' =>" in line:
-            line = "           'mozreview_auth_callback_url' => '%smozreview/bmo_auth_callback/',\n" % rburl
+            line = "           'mozreview_auth_callback_url' => '%s',\n" % mr_cb_url
+        elif "'mozreview_app_id' =>" in line:
+            line = "           'mozreview_app_id' => '%s',\n" % mr_app_id
 
         fh.write(line)
 
 for proc in psutil.process_iter():
     if proc.name() != 'apache2':
         continue
 
     if proc.username() != 'bugzilla':