示例#1
0
    def handle_message(self, body, message):
        if not self.masters:
            self._load_masters()

        if "-07" in body['_meta']['sent']:
            if not hasattr(self, 'bad_masters'):
                self.bad_masters = []

            if body['_meta']['master_name'] not in self.bad_masters:
                print body['_meta']['sent'], body['_meta']['master_name']
                self.bad_masters.append(body['_meta']['master_name'])

        results = body['payload']['results']
        if results in (SUCCESS, WARNINGS):
            message.ack()
            return

        self.failures.append( (time.time(), message) )
        master_host, master_dir = body['_meta']['master_name'].split(':')
        port = None
        for master in self.masters:
            if master['db_name'] == body['_meta']['master_name']:
                port = master['http_port']
                break
        else:
            log.info("Couldn't find master for %s", body['_meta'])
            return

        props = dict( (p[0], p[1]) for p in body['payload']['build']['properties'])
        if 'buildername' not in props:
            log.info("No buildername in %s", body)
            return

        buildername = urllib.quote(props['buildername'], "")
        buildnumber = props['buildnumber']

        url = "http://%(master_host)s:%(port)s/builders/%(buildername)s/builds/%(buildnumber)s" % locals()
        log.info("%s %s", results_str[results], url)
示例#2
0
 def quote(url):
     (scheme, authority, path, parameters, query, fragment) = urlparse(url)
     query = '&'.join(['='.join([ x for x in q.split('=')]) for q in query.split('&')])
     fragment = quote(fragment)
     return urlunparse((scheme, authority, path, parameters, query, fragment))