Esempio n. 1
0
def logError(request, e_type, e_value, e_tb, doEmail=True):
    info = dict(request.META)
    info['is_secure'] = request.is_secure()
    if request.raw_post_data:
        info.update(raw_post_data = request.raw_post_data)
    try:
        cfg = getattr(request, "cfg", None)
        logerror.logErrorAndEmail(cfg, e_type, e_value,
                e_tb, 'API call (django handler)', info, doEmail=doEmail)
    except mint_error.MailError, err:
        log.error("Error sending mail: %s", str(err))
Esempio n. 2
0
 def logError(self, request, e_type, e_value, e_tb, doEmail=True):
     info = {
             'uri'               : request.thisUrl,
             'path'              : request.path,
             'method'            : request.method,
             'headers_in'        : request.headers,
             'request_params'    : request.GET,
             'post_params'       : request.POST,
             'remote'            : request.remote,
             }
     try:
         logerror.logErrorAndEmail(self.controller.cfg, e_type, e_value,
                 e_tb, 'API call', info, doEmail=doEmail)
     except mint_error.MailError, err:
         log.error("Error sending mail: %s", str(err))
Esempio n. 3
0
 def logError(self, request, e_type, e_value, e_tb, doEmail=True):
     info = {
             'uri'               : request.thisUrl,
             'path'              : request.path,
             'method'            : request.method,
             'headers_in'        : request.headers,
             'request_params'    : request.GET,
             'post_params'       : request.POST,
             'remote'            : '[%s]:%d' % request.remote[:2],
             }
     try:
         logerror.logErrorAndEmail(self.controller.cfg, e_type, e_value,
                 e_tb, 'API call', info, doEmail=doEmail)
     except mint_error.MailError, err:
         log.error("Error sending mail: %s", str(err))
Esempio n. 4
0
 def processJobResults(self, job):
     jobState = modellib.Cache.get(models.JobState, pk=job.job_state_id)
     if jobState.name != jobState.COMPLETED:
         job.results = None
         return None
     tsid = transaction.savepoint()
     try:
         resources = self._processJobResults(job)
     except Exception, e:
         transaction.savepoint_rollback(tsid)
         e_type, e_value, e_tb = sys.exc_info()
         log.error("Error processing job %s %s", job.job_uuid, e)
         try:
             handled = self.handleError(job, e)
         except exceptions.AttributeError:
             handled = False
         if handled:
             return None
         logErrorAndEmail(self.mgr.cfg, e_type, e_value, e_tb, "jobs handler", dict(), doEmail=True)
         self.handleErrorDefault(job, e)
         return None
Esempio n. 5
0
def process(repos, cfg, commitList, srcMap, pkgMap, grpMap, argv, otherArgs):
    coveragehook.install()
    if not len(argv) and not len(otherArgs):
        return 1

    mintutils.setupLogging(consoleLevel=logging.WARNING,
            consoleFormat='apache')
    
    argDef = {
        'config' : options.ONE_PARAM,
        'user': options.ONE_PARAM,
        'hostname': options.ONE_PARAM,
    }

    # create an argv[0] for processArgs to ignore
    argv[0:0] = ['']
    argSet, someArgs = options.processArgs(argDef, {}, cfg, '', argv=argv)
    # and now remove argv[0] again
    argv.pop(0)
    if len(someArgs):
        someArgs.pop(0)
    otherArgs.extend(someArgs)

    # Double-fork so the commit hook doesn't block the caller.
    if os.fork():
        return 0

    try:
        if not os.fork():
            try:
                registerCommits(argSet, commitList)
            except:
                e_type, e_value, e_tb = sys.exc_info()
                logErrorAndEmail(None, e_type, e_value, e_tb, 'commit hook',
                        argSet)
    finally:
        os._exit(0)