OLD | NEW |
1 # coding: utf-8 | 1 # coding: utf-8 |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 """Defines class Rietveld to easily access a rietveld instance. | 5 """Defines class Rietveld to easily access a rietveld instance. |
6 | 6 |
7 Security implications: | 7 Security implications: |
8 | 8 |
9 The following hypothesis are made: | 9 The following hypothesis are made: |
10 - Rietveld enforces: | 10 - Rietveld enforces: |
(...skipping 22 matching lines...) Expand all Loading... |
33 # Hack out upload logging.info() | 33 # Hack out upload logging.info() |
34 upload.logging = logging.getLogger('upload') | 34 upload.logging = logging.getLogger('upload') |
35 # Mac pylint choke on this line. | 35 # Mac pylint choke on this line. |
36 upload.logging.setLevel(logging.WARNING) # pylint: disable=E1103 | 36 upload.logging.setLevel(logging.WARNING) # pylint: disable=E1103 |
37 | 37 |
38 | 38 |
39 class Rietveld(object): | 39 class Rietveld(object): |
40 """Accesses rietveld.""" | 40 """Accesses rietveld.""" |
41 def __init__(self, url, email, password, extra_headers=None): | 41 def __init__(self, url, email, password, extra_headers=None): |
42 self.url = url.rstrip('/') | 42 self.url = url.rstrip('/') |
| 43 # Email and password are accessed by commit queue, keep them. |
| 44 self.email = email |
| 45 self.password = password |
43 # TODO(maruel): It's not awesome but maybe necessary to retrieve the value. | 46 # TODO(maruel): It's not awesome but maybe necessary to retrieve the value. |
44 # It happens when the presubmit check is ran out of process, the cookie | 47 # It happens when the presubmit check is ran out of process, the cookie |
45 # needed to be recreated from the credentials. Instead, it should pass the | 48 # needed to be recreated from the credentials. Instead, it should pass the |
46 # email and the cookie. | 49 # email and the cookie. |
47 if email and password: | 50 if email and password: |
48 get_creds = lambda: (email, password) | 51 get_creds = lambda: (email, password) |
49 self.rpc_server = upload.HttpRpcServer( | 52 self.rpc_server = upload.HttpRpcServer( |
50 self.url, | 53 self.url, |
51 get_creds, | 54 get_creds, |
52 extra_headers=extra_headers or {}) | 55 extra_headers=extra_headers or {}) |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 def trigger_try_jobs( # pylint:disable=R0201 | 696 def trigger_try_jobs( # pylint:disable=R0201 |
694 self, issue, patchset, reason, clobber, revision, builders_and_tests, | 697 self, issue, patchset, reason, clobber, revision, builders_and_tests, |
695 master=None): | 698 master=None): |
696 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % | 699 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % |
697 (builders_and_tests, issue)) | 700 (builders_and_tests, issue)) |
698 | 701 |
699 def trigger_distributed_try_jobs( # pylint:disable=R0201 | 702 def trigger_distributed_try_jobs( # pylint:disable=R0201 |
700 self, issue, patchset, reason, clobber, revision, masters): | 703 self, issue, patchset, reason, clobber, revision, masters): |
701 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % | 704 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % |
702 (masters, issue)) | 705 (masters, issue)) |
OLD | NEW |