server_job.run should only remove the uncollected_logs file if it created it. The method may be used recursively, so the call that creates it is the one responsible for removing it.
Signed-off-by: John Admanski <jadmanski@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@4313 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/server_job.py b/server/server_job.py
index d4c01e7..db03a9e 100644
--- a/server/server_job.py
+++ b/server/server_job.py
@@ -379,6 +379,7 @@
control_file_dir=None, only_collect_crashinfo=False):
# for a normal job, make sure the uncollected logs file exists
# for a crashinfo-only run it should already exist, bail out otherwise
+ created_uncollected_logs = False
if self.resultdir and not os.path.exists(self._uncollected_log_file):
if only_collect_crashinfo:
# if this is a crashinfo-only run, and there were no existing
@@ -390,6 +391,7 @@
log_file = open(self._uncollected_log_file, "w")
pickle.dump([], log_file)
log_file.close()
+ created_uncollected_logs = True
# use a copy so changes don't affect the original dictionary
namespace = namespace.copy()
@@ -476,7 +478,7 @@
self._execute_code(CRASHINFO_CONTROL_FILE, namespace)
else:
self._execute_code(CRASHDUMPS_CONTROL_FILE, namespace)
- if self._uncollected_log_file:
+ if self._uncollected_log_file and created_uncollected_logs:
os.remove(self._uncollected_log_file)
self.disable_external_logging()
if cleanup and machines: