提交 68e7c9ca 编写于 作者: L Lukáš Doktor

plugins.human: Avoid signaling too long fail-reasons in UI

The 98442498 added fail-reason to UI,
but for some tests this could be multiple lines of explanation, which
does not really fit in the UI purpose. Let's limit the maximum size to
255 chars (this number is not important, it just have to be sensible)
and avoid '\n' in the output.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 4913281c
......@@ -79,6 +79,9 @@ class Human(ResultEvents):
out = (output.TERM_SUPPORT.MOVE_BACK + self.output_mapping[status] +
status)
if extra:
if len(extra) > 255:
extra = extra[:255] + '...'
extra = extra.replace('\n', '\\n')
out += ": " + extra
out += output.TERM_SUPPORT.ENDC
return out
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册