From 0b4832bbf5ece7c6d099c829887dab0dd6cd19a5 Mon Sep 17 00:00:00 2001 From: Pengyu Lv Date: Fri, 28 Apr 2023 11:14:28 +0800 Subject: [PATCH] cert_audit: Sort the outputs by not_valid_after date Signed-off-by: Pengyu Lv --- tests/scripts/audit-validity-dates.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/scripts/audit-validity-dates.py b/tests/scripts/audit-validity-dates.py index 5729ee9886..81c69d3701 100755 --- a/tests/scripts/audit-validity-dates.py +++ b/tests/scripts/audit-validity-dates.py @@ -487,11 +487,13 @@ def main(): filter_func = lambda d: (start_date < d.not_valid_before) or \ (d.not_valid_after < end_date) + sortby_end = lambda d: d.not_valid_after + if args.all: filter_func = None # filter and output the results - for d in filter(filter_func, audit_results): + for d in sorted(filter(filter_func, audit_results), key=sortby_end): list_all(d) logger.debug("Done!")