Skip to content

Commit

Permalink
Fix: report: Fix a regression for irregular file collection (#1620)
Browse files Browse the repository at this point in the history
Single irregular file like crm.conf and profiles.yml are not collected,
which was introduced by commit 210661b.

Should determine if the file does have archived logs first.
  • Loading branch information
liangxin1300 authored Nov 27, 2024
2 parents ae21432 + 742b0ef commit 3e90e46
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 3e90e46

Please sign in to comment.