From: Michael Goldish <mgold...@redhat.com> Use python's splitlines() instead of "head -n 1" because the latter causes "broken pipe" messages in some configurations.
Signed-off-by: Michael Goldish <mgold...@redhat.com> diff --git a/client/tests/kvm_runtest_2/make_html_report.py b/client/tests/kvm_runtest_2/make_html_report.py index 677da78..002062c 100755 --- a/client/tests/kvm_runtest_2/make_html_report.py +++ b/client/tests/kvm_runtest_2/make_html_report.py @@ -1636,12 +1636,14 @@ def get_keyval_value(result_dir, key): If no appropriate line is found, return 'Unknown'. """ keyval_pattern = os.path.join(result_dir, "kvm_runtest_2.*", "keyval") - keyval_line = commands.getoutput("grep -h %s %s | head -n 1" % (key, keyval_pattern)) + keyval_lines = commands.getoutput(r"grep -h '\b%s\b.*=' %s" % (key, keyval_pattern)) + if not keyval_lines: + return "Unknown" + keyval_line = keyval_lines.splitlines()[0] if key in keyval_line and "=" in keyval_line: - value = keyval_line.split("=")[1].strip() + return keyval_line.split("=")[1].strip() else: - value = "Unknown" - return value + return "Unknown" def get_kvm_version(result_dir): -- To unsubscribe from this list: send the line "unsubscribe kvm-commits" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html