summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Toman <mtoman@redhat.com>2011-05-02 12:46:36 +0200
committerMichal Toman <mtoman@redhat.com>2011-05-02 12:46:36 +0200
commit9bf63c4a4036e9b712de372ed1a4cdae08c273ed (patch)
treec1d93863abb606427541662468a0d9934f67277b
parent94cb0278e29797645ec1df16ca7274bdfd89ee65 (diff)
downloadabrt-9bf63c4a4036e9b712de372ed1a4cdae08c273ed.tar.gz
abrt-9bf63c4a4036e9b712de372ed1a4cdae08c273ed.tar.xz
abrt-9bf63c4a4036e9b712de372ed1a4cdae08c273ed.zip
retrace server: remove chroot on failure
-rw-r--r--src/retrace/retrace.py15
-rwxr-xr-xsrc/retrace/worker.py3
2 files changed, 10 insertions, 8 deletions
diff --git a/src/retrace/retrace.py b/src/retrace/retrace.py
index 39588d90..b1568891 100644
--- a/src/retrace/retrace.py
+++ b/src/retrace/retrace.py
@@ -315,7 +315,7 @@ def kill_process_and_childs(process_id, ps_output=None):
return result
-def cleanup_task(taskid):
+def cleanup_task(taskid, gc=True):
null = open("/dev/null", "w")
savedir = "%s/%d" % (CONFIG["SaveDir"], taskid)
@@ -334,12 +334,13 @@ def cleanup_task(taskid):
except:
pass
- try:
- log = open(newlog, "a")
- log.write("Killed by garbage collector\n")
- log.close()
- except:
- pass
+ if gc:
+ try:
+ log = open(newlog, "a")
+ log.write("Killed by garbage collector\n")
+ log.close()
+ except:
+ pass
null.close()
diff --git a/src/retrace/worker.py b/src/retrace/worker.py
index ad2badf1..f3255c2a 100755
--- a/src/retrace/worker.py
+++ b/src/retrace/worker.py
@@ -27,8 +27,9 @@ def set_status(statusid):
def fail(exitcode):
"Kills script with given exitcode"
- LOG.close()
set_status(STATUS_FAIL)
+ LOG.close()
+ cleanup_task(int(taskid), False)
sys.exit(exitcode)
def retrace_run(errorcode, cmd):