Esempio n. 1
0
 def send(self, **kwargs):
     "Sends the message to the server."
     if conf.REMOTE_URL:
         for url in conf.REMOTE_URL:
             data = {"data": base64.b64encode(pickle.dumps(kwargs).encode("zlib")), "key": conf.KEY}
             try:
                 urlread(url, post=data, timeout=conf.REMOTE_TIMEOUT)
             except urllib2.HTTPError, e:
                 body = e.read()
                 logger.error(
                     "Unable to reach Sentry log server: %s (url: %%s, body: %%s)" % (e,),
                     url,
                     body,
                     exc_info=sys.exc_info(),
                     extra={"data": {"body": body, "remote_url": url}},
                 )
                 logger.log(kwargs.pop("level", None) or logging.ERROR, kwargs.pop("message", None))
             except urllib2.URLError, e:
                 logger.error(
                     "Unable to reach Sentry log server: %s (url: %%s)" % (e,),
                     url,
                     exc_info=sys.exc_info(),
                     extra={"data": {"remote_url": url}},
                 )
                 logger.log(kwargs.pop("level", None) or logging.ERROR, kwargs.pop("message", None))
Esempio n. 2
0
 def send(self, **kwargs):
     if conf.REMOTE_URL:
         for url in conf.REMOTE_URL:
             data = {
                 'data': base64.b64encode(pickle.dumps(kwargs).encode('zlib')),
                 'key': conf.KEY,
             }
             try:
                 urlread(url, GET=data, timeout=conf.REMOTE_TIMEOUT)
             except urllib2.URLError, e:
                 logger.error('Unable to reach Sentry log server: %s' % (e,), exc_info=sys.exc_info(), extra={'remote_url': url})
                 logger.log(kwargs.pop('level', None) or logging.ERROR, kwargs.pop('message', None))
             except urllib2.HTTPError, e:
                 logger.error('Unable to reach Sentry log server: %s' % (e,), exc_info=sys.exc_info(), extra={'body': e.read(), 'remote_url': url})
                 logger.log(kwargs.pop('level', None) or logging.ERROR, kwargs.pop('message', None))
Esempio n. 3
0
    def perform(self, request, group):
        if request.POST:
            form = RedmineIssueForm(request.POST)
            if form.is_valid():
                data = {
                    'key': conf.REDMINE_API_KEY,
                    'project_id': conf.REDMINE_PROJECT_ID,
                    'subject': form.cleaned_data['subject'],
                    'description': form.cleaned_data['description']
                }
                response = urlread(conf.REDMINE_URL + '/issues.json', POST=data)
                print response
                #RedmineIssue.objects.create(group=group, issue_id=response['issue_id'])
                
        else:
            description = 'Sentry Message: %s' % request.build_absolute_uri(group.get_absolute_url())
            description += '\n\n' + (group.traceback or group.message)

            form = RedmineIssueForm(initial={
                'subject': group.error(),
                'description': description,
            })

        BASE_TEMPLATE = "sentry/group/details.html"

        context = locals()
        context.update(csrf(request))

        return render_to_response('sentry/plugins/redmine/create_issue.html', context)
Esempio n. 4
0
 def send(self, **kwargs):
     "Sends the message to the server."
     if conf.REMOTE_URL:
         for url in conf.REMOTE_URL:
             data = {
                 'data': base64.b64encode(pickle.dumps(kwargs).encode('zlib')),
                 'key': conf.KEY,
             }
             try:
                 urlread(url, post=data, timeout=conf.REMOTE_TIMEOUT)
             except urllib2.HTTPError, e:
                 body = e.read()
                 logger.error('Unable to reach Sentry log server: %s (url: %%s, body: %%s)' % (e,), url, body,
                              exc_info=sys.exc_info(), extra={'data':{'body': body, 'remote_url': url}})
                 logger.log(kwargs.pop('level', None) or logging.ERROR, kwargs.pop('message', None))
             except urllib2.URLError, e:
                 logger.error('Unable to reach Sentry log server: %s (url: %%s)' % (e,), url,
                              exc_info=sys.exc_info(), extra={'data':{'remote_url': url}})
                 logger.log(kwargs.pop('level', None) or logging.ERROR, kwargs.pop('message', None))
Esempio n. 5
0
 def send_remote(self, url=None, data=None):
     return urlread(url, post=data, timeout=conf.REMOTE_TIMEOUT)
Esempio n. 6
0
 def send_remote(self, url=None, data=None):
     return urlread(url, post=data, timeout=conf.REMOTE_TIMEOUT)