mirror of
https://github.com/ansible/awx.git
synced 2026-02-22 21:46:00 -03:30
move the partition data migration to be a post-upgrade async process
this copies the approach we took with the bigint migration
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
# All Rights Reserved.
|
||||
|
||||
# Python
|
||||
import datetime
|
||||
import dateutil
|
||||
import functools
|
||||
import html
|
||||
@@ -174,6 +175,9 @@ from awx.api.views.root import ( # noqa
|
||||
from awx.api.views.webhooks import WebhookKeyView, GithubWebhookReceiver, GitlabWebhookReceiver # noqa
|
||||
|
||||
|
||||
EPOCH = datetime.datetime.utcfromtimestamp(0)
|
||||
|
||||
|
||||
logger = logging.getLogger('awx.api.views')
|
||||
|
||||
|
||||
@@ -887,7 +891,9 @@ class ProjectUpdateEventsList(SubListAPIView):
|
||||
job = self.get_parent_object()
|
||||
self.check_parent_access(job)
|
||||
qs = super(ProjectUpdateEventsList, self).get_queryset()
|
||||
return qs.filter(job_created=job.created).order_by('start_line').all()
|
||||
return qs.filter(
|
||||
job_created__in=(job.created, EPOCH)
|
||||
).order_by('start_line').all()
|
||||
|
||||
class SystemJobEventsList(SubListAPIView):
|
||||
|
||||
@@ -905,7 +911,9 @@ class SystemJobEventsList(SubListAPIView):
|
||||
def get_queryset(self):
|
||||
job = self.get_parent_object()
|
||||
self.check_parent_access(job)
|
||||
qs = job.system_job_events.select_related('host').filter(job_created=job.created).order_by('start_line')
|
||||
qs = job.system_job_events.select_related('host').filter(
|
||||
job_created__in=(job.created, EPOCH)
|
||||
).order_by('start_line')
|
||||
return qs.all()
|
||||
|
||||
class ProjectUpdateCancel(RetrieveAPIView):
|
||||
@@ -3809,7 +3817,7 @@ class HostJobEventsList(BaseJobEventsList):
|
||||
def get_queryset(self):
|
||||
parent_obj = self.get_parent_object()
|
||||
self.check_parent_access(parent_obj)
|
||||
qs = self.request.user.get_queryset(self.model).filter(host=parent_obj, job_created=parent_obj.created)
|
||||
qs = self.request.user.get_queryset(self.model).filter(host=parent_obj)
|
||||
return qs
|
||||
|
||||
|
||||
@@ -3825,7 +3833,9 @@ class JobJobEventsList(BaseJobEventsList):
|
||||
def get_queryset(self):
|
||||
job = self.get_parent_object()
|
||||
self.check_parent_access(job)
|
||||
qs = job.job_events.filter(job_created=job.created).select_related('host').order_by('start_line')
|
||||
qs = job.job_events.filter(
|
||||
job_created__in=(job.created, EPOCH)
|
||||
).select_related('host').order_by('start_line')
|
||||
return qs.all()
|
||||
|
||||
|
||||
@@ -4008,7 +4018,9 @@ class BaseAdHocCommandEventsList(NoTruncateMixin, SubListAPIView):
|
||||
def get_queryset(self):
|
||||
job = self.get_parent_object()
|
||||
self.check_parent_access(job)
|
||||
qs = job.ad_hoc_command_events.select_related('host').filter(job_created=job.created).order_by('start_line')
|
||||
qs = job.ad_hoc_command_events.select_related('host').filter(
|
||||
job_created__in=(job.created, EPOCH)
|
||||
).order_by('start_line')
|
||||
return qs.all()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user