Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : master
---------------------------------------------------------------
commit 673444173f97245e2c260187e1a3a5a014812fa4
Author: Miroslav Suchý <miroslav(a)suchy.cz>
Date: Mon Dec 30 14:09:09 2013 +0100
[backend] do not traceback if jobfile is mangled
in my case was zero sized which raised ValueError exception
---------------------------------------------------------------
backend/dispatcher.py | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/backend/dispatcher.py b/backend/dispatcher.py
index ee2dc86..16adfdb 100644
--- a/backend/dispatcher.py
+++ b/backend/dispatcher.py
@@ -215,7 +215,11 @@ class Worker(multiprocessing.Process):
def parse_job(self, jobfile):
# read the json of the job in
# break out what we need return a bunch of the info we need
- build = json.load(open(jobfile))
+ try:
+ build = json.load(open(jobfile))
+ except ValueError:
+ # empty file?
+ return None
jobdata = Bunch()
jobdata.pkgs = build['pkgs'].split(' ')
jobdata.repos = [r for r in build['repos'].split(' ') if
r.strip() ]
@@ -298,6 +302,10 @@ class Worker(multiprocessing.Process):
# parse the job json into our info
job = self.parse_job(jobfile)
+ if job is None:
+ self.callback.log('jobfile %s is mangled, please investigate' %
jobfile)
+ time.sleep(self.opts.sleeptime)
+ continue
# FIXME
# this is our best place to sanity check the job before starting
# up any longer process