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

Fix: report: Fix a regression for irregular file collection #1620

Merged
merged 1 commit into from
Nov 27, 2024
Merged
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
5 changes: 3 additions & 2 deletions crmsh/report/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ def arch_logs(context: core.Context, logf: str) -> Tuple[List[str], LogType]:
log_type = None

file_list = [logf] + glob.glob(logf+"*[0-9z]")
do_have_archived_logs = len(file_list) > 1
# like ls -t, newest first
for f in sorted(file_list, key=os.path.getmtime, reverse=True):
modify_time = os.path.getmtime(f)
if context.from_time > modify_time:
# for those archived logs, if the newest one is older than the from_time
if do_have_archived_logs and context.from_time > os.path.getmtime(f):
break # no need to check the rest
tmp = is_our_log(context, f)
logger.debug2("File %s is %s", f, convert_logtype_to_str(tmp))
Expand Down