def render_GET(self, request): try: alloc = allocate.Allocation(self.slave) except exceptions.NoAllocationError: alloc = None request.setHeader('content-type', 'application/json') if not alloc: request.setResponseCode(404) return simplejson.dumps(dict(success=False)) else: return simplejson.dumps(dict( success=True, tac=buildbottac.make_buildbot_tac(alloc)))
def gettac(_): try: allocation = allocate.Allocation(slave_name) except exceptions.NoAllocationError: log.msg("rejecting slave '%s'" % slave_name) raise tac = buildbottac.make_buildbot_tac(allocation) allocation.commit() if allocation.enabled: log.msg("allocated '%s' to '%s' (%s:%s)" % (slave_name, allocation.master_nickname, allocation.master_fqdn, allocation.master_pb_port)) else: log.msg("slave '%s' is disabled; no allocation made" % slave_name) return tac