correct filter events on the migration event horizon

events that existed *prior* to the partition migration will have
`job_created=1970-01-01` auto-applied at migration time; as such,
queries for these events e.g., /api/v2/job/N/job_events/
use 1970-01-01 in related event searche

events created *after* the partition migration (net-new playbook runs
will have `job_created` values that *exactly match* the related
`UnifiedJob.created` field.
This commit is contained in:
Ryan Petrello
2021-02-25 17:51:29 -05:00
committed by Jim Ladd
parent 1e45e2ab9b
commit 08b96a0bd7
4 changed files with 41 additions and 11 deletions

View File

@@ -41,8 +41,6 @@ from awx.api.views.mixin import RelatedJobsPreventDeleteMixin, ControlledByScmMi
logger = logging.getLogger('awx.api.views.organization')
EPOCH = datetime.datetime.utcfromtimestamp(0)
class InventoryUpdateEventsList(SubListAPIView):
@@ -55,7 +53,7 @@ class InventoryUpdateEventsList(SubListAPIView):
def get_queryset(self):
return super(InventoryUpdateEventsList, self).get_queryset().filter(
job_created__in=(self.get_parent_object().created, EPOCH)
job_created=self.get_parent_object().created_or_epoch
)
def finalize_response(self, request, response, *args, **kwargs):