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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 client_email, | 557 client_email, |
558 client_private_key_file, | 558 client_private_key_file, |
559 private_key_password=None, | 559 private_key_password=None, |
560 extra_headers=None, | 560 extra_headers=None, |
561 maxtries=None): | 561 maxtries=None): |
562 | 562 |
563 if private_key_password is None: # '' means 'empty password' | 563 if private_key_password is None: # '' means 'empty password' |
564 private_key_password = 'notasecret' | 564 private_key_password = 'notasecret' |
565 | 565 |
566 self.url = url.rstrip('/') | 566 self.url = url.rstrip('/') |
567 bot_url = self.url + '/bots' | 567 bot_url = self.url |
| 568 if self.url.endswith('googleplex.com'): |
| 569 bot_url = self.url + '/bots' |
568 | 570 |
569 with open(client_private_key_file, 'rb') as f: | 571 with open(client_private_key_file, 'rb') as f: |
570 client_private_key = f.read() | 572 client_private_key = f.read() |
571 logging.info('Using OAuth login: %s' % client_email) | 573 logging.info('Using OAuth login: %s' % client_email) |
572 self.rpc_server = OAuthRpcServer(bot_url, | 574 self.rpc_server = OAuthRpcServer(bot_url, |
573 client_email, | 575 client_email, |
574 client_private_key, | 576 client_private_key, |
575 private_key_password=private_key_password, | 577 private_key_password=private_key_password, |
576 extra_headers=extra_headers or {}) | 578 extra_headers=extra_headers or {}) |
577 self._xsrf_token = None | 579 self._xsrf_token = None |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 self, issue, patchset, reason, clobber, revision, builders_and_tests, | 700 self, issue, patchset, reason, clobber, revision, builders_and_tests, |
699 master=None, category='cq'): | 701 master=None, category='cq'): |
700 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % | 702 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % |
701 (builders_and_tests, issue)) | 703 (builders_and_tests, issue)) |
702 | 704 |
703 def trigger_distributed_try_jobs( # pylint:disable=R0201 | 705 def trigger_distributed_try_jobs( # pylint:disable=R0201 |
704 self, issue, patchset, reason, clobber, revision, masters, | 706 self, issue, patchset, reason, clobber, revision, masters, |
705 category='cq'): | 707 category='cq'): |
706 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % | 708 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % |
707 (masters, issue)) | 709 (masters, issue)) |
OLD | NEW |