Skip to content

Commit

Permalink
[crmsh-4.6] Fix: report: Fix a regression for irregular file collecti…
Browse files Browse the repository at this point in the history
…on (#1621)

backport #1620
  • Loading branch information
liangxin1300 authored Nov 27, 2024
2 parents 0fe80c0 + 86532f3 commit 0924592
Showing 1 changed file with 3 additions and 2 deletions.
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

0 comments on commit 0924592

Please sign in to comment.