diff options
Diffstat (limited to 'Post/parser.py')
-rw-r--r-- | Post/parser.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/Post/parser.py b/Post/parser.py index 7311649..b293293 100644 --- a/Post/parser.py +++ b/Post/parser.py @@ -53,9 +53,16 @@ class Parser: b.EMAIL = str(jsondata['email']) b.LINK_BACK = jsondata.get("link_back", None) + # Extract the branch and commit g = re.match(r'(.*): (.*)', jsondata['branch_commit']) - b.BRANCH = str(g.group(1)) - b.COMMIT = str(g.group(2)) + + if g and g.lastindex == 2: + b.BRANCH = g.group(1) + b.COMMIT = g.group(2) + else: + b.BRANCH = "unknown" + b.COMMIT = "unknown" + b.DATE = timezone.now() b.save() @@ -67,9 +74,18 @@ class Parser: if len(fail) > int(settings.MAX_UPLOAD_SIZE): build_fails_logged.append({ 'id': -1, 'error' : "The size of the upload is too large" }) continue + + #Extract the recipe and version package = str(fail['package']) g = re.match(r'(.*)\-(\d.*)', package) - f = BuildFailure(TASK = str(fail['task']), RECIPE = g.group(1), RECIPE_VERSION = g.group(2), ERROR_DETAILS = str(fail['log']), BUILD = b) + if g and g.lastindex == 2: + recipe = g.group(1) + recipe_version = g.group(2) + else: + recipe = package + recipe_version = "unknown" + + f = BuildFailure(TASK = str(fail['task']), RECIPE = recipe, RECIPE_VERSION = recipe_version, ERROR_DETAILS = str(fail['log']), BUILD = b) f.save() url = 'http://' + host + reverse('details', args=[f.id]) |