Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(692)

Side by Side Diff: scripts/master/try_job_rietveld.py

Issue 10804037: Fix up try job reitveld patch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import hashlib 5 import hashlib
6 import json 6 import json
7 import os
7 import time 8 import time
8 import urllib 9 import urllib
9 import urlparse 10 import urlparse
10 11
11 from buildbot.changes import base 12 from buildbot.changes import base
12 from buildbot.schedulers.trysched import BadJobfile 13 from buildbot.schedulers.trysched import BadJobfile
13 from twisted.application import internet 14 from twisted.application import internet
14 from twisted.internet import defer 15 from twisted.internet import defer
15 from twisted.python import log 16 from twisted.python import log
16 from twisted.web import client 17 from twisted.web import client
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 d = defer.succeed(None) 56 d = defer.succeed(None)
56 d.addCallback(self._GetUsers) 57 d.addCallback(self._GetUsers)
57 d.addCallback(self._MakeSet) 58 d.addCallback(self._MakeSet)
58 d.addErrback(log.err, 'error in ValidUserPoller') 59 d.addErrback(log.err, 'error in ValidUserPoller')
59 return d 60 return d
60 61
61 def _GetUsers(self, _): 62 def _GetUsers(self, _):
62 """Downloads list of valid users. 63 """Downloads list of valid users.
63 64
64 Returns: 65 Returns:
65 A frozenset of string containing the email addresses of users allowed to 66 A string of lines containing the email addresses of users allowed to
66 send jobs from Rietveld. 67 send jobs from Rietveld.
67 """ 68 """
68 try: 69 if not os.path.isfile(self._PWD_FILE):
69 pwd = open(self._PWD_FILE).readline().strip() 70 log.msg("No password file %s; no valid users.")
70 except IOError: 71 return ""
71 return frozenset([])
72 72
73 pwd = open(self._PWD_FILE).readline().strip()
73 now_string = str(int(time.time())) 74 now_string = str(int(time.time()))
74 params = { 75 params = {
75 'md5': hashlib.md5(pwd + now_string).hexdigest(), 76 'md5': hashlib.md5(pwd + now_string).hexdigest(),
76 'time': now_string 77 'time': now_string
77 } 78 }
79
M-A Ruel 2012/07/19 22:47:23 This new line is not 100% necessary. :)
78 return client.getPage('https://chromium-access.appspot.com/auto/users', 80 return client.getPage('https://chromium-access.appspot.com/auto/users',
79 agent='buildbot', 81 agent='buildbot',
80 method='POST', 82 method='POST',
81 postdata=urllib.urlencode(params)) 83 postdata=urllib.urlencode(params))
82 84
83 def _MakeSet(self, data): 85 def _MakeSet(self, data):
84 """Converts the input data string into a set of email addresses. 86 """Converts the input data string into a set of email addresses.
85 """ 87 """
86 emails = (email.strip() for email in data.splitlines()) 88 emails = (email.strip() for email in data.splitlines())
87 self._users = frozenset(email for email in emails if email) 89 self._users = frozenset(email for email in emails if email)
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 238
237 for ex in exceptions: 239 for ex in exceptions:
238 log.msg(ex) 240 log.msg(ex)
239 241
240 # TryJobBase overrides: 242 # TryJobBase overrides:
241 def setServiceParent(self, parent): 243 def setServiceParent(self, parent):
242 TryJobBase.setServiceParent(self, parent) 244 TryJobBase.setServiceParent(self, parent)
243 self._poller.setServiceParent(self) 245 self._poller.setServiceParent(self)
244 self._poller.master = self.master 246 self._poller.master = self.master
245 self._valid_users.setServiceParent(self) 247 self._valid_users.setServiceParent(self)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698