Skip to content

Commit

Permalink
Better support of custom modules in autoreporter (#836)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazet authored Mar 6, 2024
1 parent f82250f commit c01352e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
15 changes: 9 additions & 6 deletions artemis/reporting/export/deduplication.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,17 @@ def _process_non_ip_report(processed_report: Report) -> None:

def _all_reports_are_old(reports: List[Report]) -> bool:
for report in reports:
if SEVERITY_MAP[report.report_type] == Severity.LOW:
if report.report_type not in SEVERITY_MAP:
threshold_days = Config.Reporting.MIN_DAYS_BETWEEN_REMINDERS__SEVERITY_LOW
elif SEVERITY_MAP[report.report_type] == Severity.MEDIUM:
threshold_days = Config.Reporting.MIN_DAYS_BETWEEN_REMINDERS__SEVERITY_MEDIUM
elif SEVERITY_MAP[report.report_type] == Severity.HIGH:
threshold_days = Config.Reporting.MIN_DAYS_BETWEEN_REMINDERS__SEVERITY_HIGH
else:
assert False
if SEVERITY_MAP[report.report_type] == Severity.LOW:
threshold_days = Config.Reporting.MIN_DAYS_BETWEEN_REMINDERS__SEVERITY_LOW
elif SEVERITY_MAP[report.report_type] == Severity.MEDIUM:
threshold_days = Config.Reporting.MIN_DAYS_BETWEEN_REMINDERS__SEVERITY_MEDIUM
elif SEVERITY_MAP[report.report_type] == Severity.HIGH:
threshold_days = Config.Reporting.MIN_DAYS_BETWEEN_REMINDERS__SEVERITY_HIGH
else:
assert False

if report.timestamp and report.timestamp >= datetime.datetime.now() - datetime.timedelta(days=threshold_days):
return False
Expand Down
5 changes: 5 additions & 0 deletions scripts/export_emails
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ if exists */docker-compose.yml; then
done
fi

if exists */docker-compose.additional*; then
for DOCKER_COMPOSE_FILE in */docker-compose.additional*; do
FILE_OPTIONS="$FILE_OPTIONS -f $DOCKER_COMPOSE_FILE"
done
fi

docker compose $FILE_OPTIONS $ADDITIONAL_DOCKER_COMPOSE_OPTIONS build autoreporter
docker compose $FILE_OPTIONS $ADDITIONAL_DOCKER_COMPOSE_OPTIONS run autoreporter python3 -m artemis.reporting.export.main "$@"

0 comments on commit c01352e

Please sign in to comment.