cve-generate-chartdata: Handle unexpected files in the stats directory

A build of "stable/dunfell-nut" caused incorrect data to be added to the metrics
repo and resulted in script failures. Handle this situation better.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2024-04-26 10:48:11 +01:00
parent 87db0dccbc
commit e2ebe3dc11

View File

@ -28,7 +28,11 @@ for branch in os.listdir(args.resultsdir):
branchdir = os.path.join(args.resultsdir, branch)
for f in os.listdir(branchdir):
ts = f.split(".")[0]
rounded_ts = str(round_to_day(ts))
try:
rounded_ts = str(round_to_day(ts))
except ValueError:
# Couldn't parse a timestamp from filename
continue
if rounded_ts not in counts:
counts[rounded_ts] = {}
if branch not in counts[rounded_ts]: