diff options
author | Dan Crosta <dcrosta@10gen.com> | 2012-04-02 14:16:10 -0400 |
---|---|---|
committer | Dan Crosta <dcrosta@10gen.com> | 2012-04-02 14:16:10 -0400 |
commit | 6e4aa245bbf233b6acc7b1ebf77ad59cc5d200d8 (patch) | |
tree | 239f75c5b2bf75910e001f7465a5acca07c50206 /buildscripts/buildlogger.py | |
parent | 0d44f42712197c01c9e494c425e7b24a82f1763f (diff) | |
download | mongo-6e4aa245bbf233b6acc7b1ebf77ad59cc5d200d8.tar.gz |
use buildbot credentials, not settings.py, for buildlogger
Diffstat (limited to 'buildscripts/buildlogger.py')
-rw-r--r-- | buildscripts/buildlogger.py | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/buildscripts/buildlogger.py b/buildscripts/buildlogger.py index 2de39fdc5db..10b423b65f0 100644 --- a/buildscripts/buildlogger.py +++ b/buildscripts/buildlogger.py @@ -49,14 +49,21 @@ possible_paths = [ os.path.abspath(os.path.join(here, '..', '..')), os.path.abspath(os.path.join(here, '..', '..', '..')), ] -sys.path.extend(possible_paths) -try: - from settings import buildlogger_secret -except ImportError: - buildlogger_secret = None +username, password = None, None for path in possible_paths: - sys.path.remove(path) + buildbot_tac = os.path.join(path, 'buildbot.tac') + if os.path.isfile(buildbot_tac): + tac_globals = {} + tac_locals = {} + try: + execfile(buildbot_tac, tac_globals, tac_locals) + tac_globals.update(tac_locals) + username = tac_globals['slavename'] + password = tac_globals['passwd'] + break + except: + traceback.print_exc() URL_ROOT = 'http://buildlogs.mongodb.org/' @@ -66,8 +73,8 @@ digest_handler = urllib2.HTTPDigestAuthHandler() digest_handler.add_password( realm='buildlogs', uri=URL_ROOT, - user='buildbot', - passwd=buildlogger_secret) + user=username, + passwd=password) url_opener = urllib2.build_opener(digest_handler) def url(endpoint): @@ -343,8 +350,8 @@ if __name__ == '__main__': sys.stderr.flush() wrapper = run_and_echo - elif buildlogger_secret is None: - sys.stderr.write('buildlogger: could not find settings.py with buildlogger_secret\n') + elif username is None or password is None: + sys.stderr.write('buildlogger: could not find or import buildbot.tac for authentication\n') sys.stderr.flush() wrapper = run_and_echo |