Mercurial > bitten > bitten-test
changeset 913:5bfdd7348d6f
Allow passing the build master's URL without the /builds suffix when calling bitten-slave by appending /builds to URLs that don't have it. This also prevents bitten-slave from contacting the wrong domain if a bad URL is passed.
author | hodgestar |
---|---|
date | Thu, 19 May 2011 14:02:55 +0000 |
parents | 0cf576cea845 |
children | e36f9b446976 |
files | bitten/slave.py |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/bitten/slave.py +++ b/bitten/slave.py @@ -222,9 +222,15 @@ :param form_auth: login using AccountManager HTML form instead of HTTP authentication for all urls """ - self.urls = urls self.local = len(urls) == 1 and not urls[0].startswith('http://') \ and not urls[0].startswith('https://') + if self.local: + self.urls = urls + else: + self.urls = [ + not url.endswith('/builds') and url.rstrip('/') + '/builds' + or url for url in urls] + if name is None: name = platform.node().split('.', 1)[0].lower() self.name = name @@ -255,7 +261,7 @@ password = password \ or self.config['authentication.password'] or '' self.config.packages.pop('authentication', None) - urls = [url[:-7] for url in urls] + urls = [url[:-len('/builds')] for url in self.urls] self.password_mgr.add_password( None, urls, self.username, password) self.auth_map = dict(map(lambda x: (x, False), urls))