summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrakiss <grakiss.wanglei@huawei.com>2017-08-08 17:04:23 +0800
committergrakiss <grakiss.wanglei@huawei.com>2017-08-08 17:04:23 +0800
commit0037e756452b042cdba50a28285cc9f9797b0586 (patch)
tree327a523d4a177348803b51bd755c7bb5d8dbeed0
parent7c80a919d009666e64c231403a98b356628edfc6 (diff)
create a tar file for logs
JIRA: DOVETAIL-479 User may want to upload all logs along with the results, so others may check the running logs to make sure what' s going on during the test. Change-Id: Ia5862f99c129b8207aa91a391567ffdd5ee0829a Signed-off-by: grakiss <grakiss.wanglei@huawei.com>
-rw-r--r--dovetail/report.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/dovetail/report.py b/dovetail/report.py
index 4743c256..fc707a37 100644
--- a/dovetail/report.py
+++ b/dovetail/report.py
@@ -13,6 +13,7 @@ import urllib2
import re
import os
import datetime
+import tarfile
from pbr import version
@@ -159,9 +160,21 @@ class Report(object):
report_txt += sub_report[key]
cls.logger.info(report_txt)
+ cls.save_logs()
# cls.save(report_txt)
return report_txt
+ @classmethod
+ def save_logs(cls):
+ logs_gz = "logs.tar.gz"
+ result_dir = dt_cfg.dovetail_config['result_dir']
+
+ with tarfile.open(os.path.join(result_dir, logs_gz), "w:gz") as f_out:
+ files = os.listdir(result_dir)
+ for f in files:
+ if f not in ['workspace']:
+ f_out.add(os.path.join(result_dir, f))
+
# save to disk as default
@classmethod
def save(cls, report):