comparison bitten/slave.py @ 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 0ae349142bf2
children
comparison
equal deleted inserted replaced
911:0cf576cea845 913:5bfdd7348d6f
220 :param no_loop: for this slave to just perform a single check, regardless 220 :param no_loop: for this slave to just perform a single check, regardless
221 of whether a build is done or not 221 of whether a build is done or not
222 :param form_auth: login using AccountManager HTML form instead of 222 :param form_auth: login using AccountManager HTML form instead of
223 HTTP authentication for all urls 223 HTTP authentication for all urls
224 """ 224 """
225 self.urls = urls
226 self.local = len(urls) == 1 and not urls[0].startswith('http://') \ 225 self.local = len(urls) == 1 and not urls[0].startswith('http://') \
227 and not urls[0].startswith('https://') 226 and not urls[0].startswith('https://')
227 if self.local:
228 self.urls = urls
229 else:
230 self.urls = [
231 not url.endswith('/builds') and url.rstrip('/') + '/builds'
232 or url for url in urls]
233
228 if name is None: 234 if name is None:
229 name = platform.node().split('.', 1)[0].lower() 235 name = platform.node().split('.', 1)[0].lower()
230 self.name = name 236 self.name = name
231 self.config = Configuration(config) 237 self.config = Configuration(config)
232 self.dry_run = dry_run 238 self.dry_run = dry_run
253 self.username) 259 self.username)
254 self.form_auth = form_auth 260 self.form_auth = form_auth
255 password = password \ 261 password = password \
256 or self.config['authentication.password'] or '' 262 or self.config['authentication.password'] or ''
257 self.config.packages.pop('authentication', None) 263 self.config.packages.pop('authentication', None)
258 urls = [url[:-7] for url in urls] 264 urls = [url[:-len('/builds')] for url in self.urls]
259 self.password_mgr.add_password( 265 self.password_mgr.add_password(
260 None, urls, self.username, password) 266 None, urls, self.username, password)
261 self.auth_map = dict(map(lambda x: (x, False), urls)) 267 self.auth_map = dict(map(lambda x: (x, False), urls))
262 268
263 def _get_opener(self): 269 def _get_opener(self):
Copyright (C) 2012-2017 Edgewall Software