-
Bug
-
Resolution: Obsolete
-
Normal
-
None
-
None
-
None
-
False
-
None
-
False
It would seem that we can divide by zero in this function:
https://github.com/project-koku/koku/blob/main/koku/masu/database/ocp_report_db_accessor.py#L1497-L1514
This aggregation is likely returning zero:
cluster_hours = (
OCPUsageLineItemDailySummary.objects.filter(
usage_start__gte=start_date, usage_start__lt=end_date, cluster_id=cluster_id
).aggregate(cluster_hours=Sum(usage_column))
).get("cluster_hours")
which is passed into this expression:
Sum(usage_column) / cluster_hours * cluster_cost
It feels like this is a first of the month issue, but we should handle the case where the cluster_hours is zero.