Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CA-390127: Fix adding even the last log() messages to the output archive #93

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions tests/unit/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,9 @@ def assert_bugtool_logfile_data(logfile):
# caught and logged, the log file should contain the backtrace from the
# raised exception:
#
# FIXME: This is not working in Python 2.7 yet (in this specific case): CA-390127
# CA-390127 affects Python3 in principle too, but it does not make this test fail
# Fixing CA-390127 is a prerequisite for enabling this check for Python 2.7:
#
if sys.version_info.major > 2: # pragma: no cover
assert len(lines) == 9
for backtrace_string in MOCK_EXCEPTION_STRINGS:
assert backtrace_string in log
assert len(lines) == 9
for backtrace_string in MOCK_EXCEPTION_STRINGS:
assert backtrace_string in log


def assert_valid_inventory(bugtool, args, cap, tmp_path, base_path, filetype):
Expand Down
8 changes: 6 additions & 2 deletions xen-bugtool
Original file line number Diff line number Diff line change
Expand Up @@ -1278,8 +1278,6 @@ exclude those logs from the archive.
cmd_output(CAP_YUM, [RPM, '-qa'])
tree_output(CAP_YUM, SIGNING_KEY_INFO_DIR)

file_output(CAP_XEN_BUGTOOL, [XEN_BUGTOOL_LOG])

# permit the user to filter out data
for k in sorted(data.keys()):
if not ANSWER_YES_TO_ALL and not yes("Include '%s'? [Y/n]: " % k):
Expand Down Expand Up @@ -1316,6 +1314,12 @@ exclude those logs from the archive.
output_ts('Running commands to collect data')
collect_data(subdir, archive)

# after all is done, include all log() entries from the XEN_BUGTOOL_LOG file
if CAP_XEN_BUGTOOL in entries:
archive.addRealFile(
construct_filename(subdir, XEN_BUGTOOL_LOG, {}), XEN_BUGTOOL_LOG
)

# include inventory
include_inventory(archive, subdir)

Expand Down
Loading