# HG changeset patch # User hodgestar # Date 1305813775 0 # Node ID 5bfdd7348d6fb9ae6f9efa2c4e6578762910bbdf # Parent 0cf576cea845c33f5a4a13cc39f7a382b3994935 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. diff --git a/bitten/slave.py b/bitten/slave.py --- 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))