21 es_hostname = getenv(
"ES_HOSTNAME")
22 es_auth = getenv(
"ES_AUTH")
23 if not es_hostname
and not es_auth:
26 sha1_id = sha1(kwds[
"release"] + kwds[
"architecture"] + kwds[
"workflow"] + str(kwds[
"step"])).hexdigest()
28 if "_201" in kwds[
"release"]:
29 datepart =
"201" + kwds[
"release"].
split(
"_201")[1]
30 d = datetime.strptime(datepart,
"%Y-%m-%d-%H00")
31 payload[
"release_queue"] = kwds[
"release"].
split(
"_201")[0]
32 payload[
"release_date"] = d.strftime(
"%Y-%m-%d-%H00")
34 logFile = payload.pop(
"log_file",
"")
42 payload[
"message"] = lines
43 for l
in lines.split(
"\n"):
44 if l.startswith(
"----- Begin Fatal Exception"):
47 if l.startswith(
"----- End Fatal Exception"):
50 if l.startswith(
"%MSG-e"):
53 error_kind = re.split(
" [0-9a-zA-Z-]* [0-9:]{8} CET", error)[0].
replace(
"%MSG-e ",
"")
55 if inError ==
True and l.startswith(
"%MSG"):
57 errors.append({
"error": error,
"kind": error_kind})
67 payload[
"exception"] = exception
69 payload[
"errors"] = errors
71 payload[
"hostname"] = gethostname()
72 url =
"https://%s/ib-matrix.%s/runTheMatrix-data/%s" % (es_hostname,
73 d.strftime(
"%Y-%W-1"),
75 request = urllib2.Request(url)
77 base64string = base64.encodestring(es_auth).
replace(
'\n',
'')
78 request.add_header(
"Authorization",
"Basic %s" % base64string)
79 request.get_method =
lambda:
'PUT'
80 data = json.dumps(payload)
82 result = urllib2.urlopen(request, data=data)
83 except urllib2.HTTPError, e: