提交 7f33b941 编写于 作者: L Lukáš Doktor

avocado.core.html: Show link to file which failed to processed

The sysinfo collection can sometimes fail. Let's log a link along with
reason instead of an empty line.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 ab7e951f
...@@ -176,15 +176,17 @@ class ReportModel(object): ...@@ -176,15 +176,17 @@ class ReportModel(object):
for s_f in sysinfo_files: for s_f in sysinfo_files:
sysinfo_dict = {} sysinfo_dict = {}
sysinfo_path = os.path.join(base_path, s_f) sysinfo_path = os.path.join(base_path, s_f)
sysinfo_dict['file'] = " ".join(s_f.split("_"))
sysinfo_dict['element_id'] = '%s_heading_%s' % (phase, s_id)
sysinfo_dict['collapse_id'] = '%s_collapse_%s' % (phase, s_id)
try: try:
with codecs.open(sysinfo_path, 'r', encoding="utf-8") as sysinfo_file: with codecs.open(sysinfo_path, 'r', encoding="utf-8") as sysinfo_file:
sysinfo_dict['file'] = " ".join(s_f.split("_"))
sysinfo_dict['contents'] = sysinfo_file.read() sysinfo_dict['contents'] = sysinfo_file.read()
sysinfo_dict['element_id'] = '%s_heading_%s' % (phase, s_id)
sysinfo_dict['collapse_id'] = '%s_collapse_%s' % (phase, s_id)
except (OSError, UnicodeDecodeError) as details: except (OSError, UnicodeDecodeError) as details:
sysinfo_dict[s_f] = ('Error reading sysinfo file %s: %s' % path = os.path.relpath(sysinfo_path, self.html_output_dir)
(sysinfo_path, details)) sysinfo_dict['err'] = ("Error reading sysinfo file, check out"
"the file <a href=%s>%s</a>: %s"
% (path, path, details))
sysinfo_list.append(sysinfo_dict) sysinfo_list.append(sysinfo_dict)
s_id += 1 s_id += 1
return sysinfo_list return sysinfo_list
......
...@@ -101,6 +101,7 @@ ...@@ -101,6 +101,7 @@
<div id="{{collapse_id}}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="{{element_id}}"> <div id="{{collapse_id}}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="{{element_id}}">
<div class="panel-body"> <div class="panel-body">
<pre>{{contents}}</pre> <pre>{{contents}}</pre>
{{& err}}
</div> </div>
</div> </div>
</div> </div>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册