mirror of
https://github.com/ansible/awx.git
synced 2026-03-08 05:01:09 -02:30
black formatting
This commit is contained in:
@@ -3792,9 +3792,7 @@ class JobEventChildrenList(NoTruncateMixin, SubListAPIView):
|
|||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
parent_event = self.get_parent_object()
|
parent_event = self.get_parent_object()
|
||||||
self.check_parent_access(parent_event)
|
self.check_parent_access(parent_event)
|
||||||
return parent_event.job.get_event_queryset().filter(
|
return parent_event.job.get_event_queryset().filter(parent_uuid=parent_event.uuid)
|
||||||
parent_uuid=parent_event.uuid
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class BaseJobEventsList(NoTruncateMixin, SubListAPIView):
|
class BaseJobEventsList(NoTruncateMixin, SubListAPIView):
|
||||||
|
|||||||
@@ -501,10 +501,7 @@ class JobEvent(BasePlaybookEvent):
|
|||||||
default='',
|
default='',
|
||||||
editable=False,
|
editable=False,
|
||||||
)
|
)
|
||||||
job_created = models.DateTimeField(
|
job_created = models.DateTimeField(null=True, editable=False)
|
||||||
null=True,
|
|
||||||
editable=False
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_absolute_url(self, request=None):
|
def get_absolute_url(self, request=None):
|
||||||
return reverse('api:job_event_detail', kwargs={'pk': self.pk}, request=request)
|
return reverse('api:job_event_detail', kwargs={'pk': self.pk}, request=request)
|
||||||
@@ -587,6 +584,8 @@ class JobEvent(BasePlaybookEvent):
|
|||||||
class UnpartitionedJobEvent(JobEvent):
|
class UnpartitionedJobEvent(JobEvent):
|
||||||
class Meta:
|
class Meta:
|
||||||
proxy = True
|
proxy = True
|
||||||
|
|
||||||
|
|
||||||
UnpartitionedJobEvent._meta.db_table = '_unpartitioned_' + JobEvent._meta.db_table # noqa
|
UnpartitionedJobEvent._meta.db_table = '_unpartitioned_' + JobEvent._meta.db_table # noqa
|
||||||
|
|
||||||
|
|
||||||
@@ -613,10 +612,7 @@ class ProjectUpdateEvent(BasePlaybookEvent):
|
|||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
editable=False,
|
editable=False,
|
||||||
)
|
)
|
||||||
job_created = models.DateTimeField(
|
job_created = models.DateTimeField(null=True, editable=False)
|
||||||
null=True,
|
|
||||||
editable=False
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def host_name(self):
|
def host_name(self):
|
||||||
@@ -626,6 +622,8 @@ class ProjectUpdateEvent(BasePlaybookEvent):
|
|||||||
class UnpartitionedProjectUpdateEvent(ProjectUpdateEvent):
|
class UnpartitionedProjectUpdateEvent(ProjectUpdateEvent):
|
||||||
class Meta:
|
class Meta:
|
||||||
proxy = True
|
proxy = True
|
||||||
|
|
||||||
|
|
||||||
UnpartitionedProjectUpdateEvent._meta.db_table = '_unpartitioned_' + ProjectUpdateEvent._meta.db_table # noqa
|
UnpartitionedProjectUpdateEvent._meta.db_table = '_unpartitioned_' + ProjectUpdateEvent._meta.db_table # noqa
|
||||||
|
|
||||||
|
|
||||||
@@ -796,10 +794,7 @@ class AdHocCommandEvent(BaseCommandEvent):
|
|||||||
default='',
|
default='',
|
||||||
editable=False,
|
editable=False,
|
||||||
)
|
)
|
||||||
job_created = models.DateTimeField(
|
job_created = models.DateTimeField(null=True, editable=False)
|
||||||
null=True,
|
|
||||||
editable=False
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_absolute_url(self, request=None):
|
def get_absolute_url(self, request=None):
|
||||||
return reverse('api:ad_hoc_command_event_detail', kwargs={'pk': self.pk}, request=request)
|
return reverse('api:ad_hoc_command_event_detail', kwargs={'pk': self.pk}, request=request)
|
||||||
@@ -818,6 +813,8 @@ class AdHocCommandEvent(BaseCommandEvent):
|
|||||||
class UnpartitionedAdHocCommandEvent(AdHocCommandEvent):
|
class UnpartitionedAdHocCommandEvent(AdHocCommandEvent):
|
||||||
class Meta:
|
class Meta:
|
||||||
proxy = True
|
proxy = True
|
||||||
|
|
||||||
|
|
||||||
UnpartitionedAdHocCommandEvent._meta.db_table = '_unpartitioned_' + AdHocCommandEvent._meta.db_table # noqa
|
UnpartitionedAdHocCommandEvent._meta.db_table = '_unpartitioned_' + AdHocCommandEvent._meta.db_table # noqa
|
||||||
|
|
||||||
|
|
||||||
@@ -843,10 +840,7 @@ class InventoryUpdateEvent(BaseCommandEvent):
|
|||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
editable=False,
|
editable=False,
|
||||||
)
|
)
|
||||||
job_created = models.DateTimeField(
|
job_created = models.DateTimeField(null=True, editable=False)
|
||||||
null=True,
|
|
||||||
editable=False
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def event(self):
|
def event(self):
|
||||||
@@ -864,6 +858,8 @@ class InventoryUpdateEvent(BaseCommandEvent):
|
|||||||
class UnpartitionedInventoryUpdateEvent(InventoryUpdateEvent):
|
class UnpartitionedInventoryUpdateEvent(InventoryUpdateEvent):
|
||||||
class Meta:
|
class Meta:
|
||||||
proxy = True
|
proxy = True
|
||||||
|
|
||||||
|
|
||||||
UnpartitionedInventoryUpdateEvent._meta.db_table = '_unpartitioned_' + InventoryUpdateEvent._meta.db_table # noqa
|
UnpartitionedInventoryUpdateEvent._meta.db_table = '_unpartitioned_' + InventoryUpdateEvent._meta.db_table # noqa
|
||||||
|
|
||||||
|
|
||||||
@@ -889,10 +885,7 @@ class SystemJobEvent(BaseCommandEvent):
|
|||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
editable=False,
|
editable=False,
|
||||||
)
|
)
|
||||||
job_created = models.DateTimeField(
|
job_created = models.DateTimeField(null=True, editable=False)
|
||||||
null=True,
|
|
||||||
editable=False
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def event(self):
|
def event(self):
|
||||||
@@ -910,4 +903,6 @@ class SystemJobEvent(BaseCommandEvent):
|
|||||||
class UnpartitionedSystemJobEvent(SystemJobEvent):
|
class UnpartitionedSystemJobEvent(SystemJobEvent):
|
||||||
class Meta:
|
class Meta:
|
||||||
proxy = True
|
proxy = True
|
||||||
|
|
||||||
|
|
||||||
UnpartitionedSystemJobEvent._meta.db_table = '_unpartitioned_' + SystemJobEvent._meta.db_table # noqa
|
UnpartitionedSystemJobEvent._meta.db_table = '_unpartitioned_' + SystemJobEvent._meta.db_table # noqa
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ from awx.main.utils import (
|
|||||||
getattr_dne,
|
getattr_dne,
|
||||||
polymorphic,
|
polymorphic,
|
||||||
schedule_task_manager,
|
schedule_task_manager,
|
||||||
get_event_partition_epoch
|
get_event_partition_epoch,
|
||||||
)
|
)
|
||||||
from awx.main.constants import ACTIVE_STATES, CAN_CANCEL
|
from awx.main.constants import ACTIVE_STATES, CAN_CANCEL
|
||||||
from awx.main.redact import UriCleaner, REPLACE_STR
|
from awx.main.redact import UriCleaner, REPLACE_STR
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ from awx.main.models import (
|
|||||||
InventoryUpdateEvent,
|
InventoryUpdateEvent,
|
||||||
AdHocCommandEvent,
|
AdHocCommandEvent,
|
||||||
SystemJobEvent,
|
SystemJobEvent,
|
||||||
build_safe_env
|
build_safe_env,
|
||||||
)
|
)
|
||||||
from awx.main.constants import ACTIVE_STATES
|
from awx.main.constants import ACTIVE_STATES
|
||||||
from awx.main.exceptions import AwxTaskError, PostRunError
|
from awx.main.exceptions import AwxTaskError, PostRunError
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ from awx.main.models import Job
|
|||||||
# created before job event tables were partitioned.
|
# created before job event tables were partitioned.
|
||||||
# This test can safely behave as if all job events were created
|
# This test can safely behave as if all job events were created
|
||||||
# after the migration, in which case Job.created_or_epoch == Job.created
|
# after the migration, in which case Job.created_or_epoch == Job.created
|
||||||
@mock.patch('awx.main.models.Job.created_or_epoch',
|
@mock.patch('awx.main.models.Job.created_or_epoch', Job.created)
|
||||||
Job.created)
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
'truncate, expected',
|
'truncate, expected',
|
||||||
@@ -38,8 +37,7 @@ def test_job_events_sublist_truncation(get, organization_factory, job_template_f
|
|||||||
# created before job event tables were partitioned.
|
# created before job event tables were partitioned.
|
||||||
# This test can safely behave as if all job events were created
|
# This test can safely behave as if all job events were created
|
||||||
# after the migration, in which case Job.created_or_epoch == Job.created
|
# after the migration, in which case Job.created_or_epoch == Job.created
|
||||||
@mock.patch('awx.main.models.ad_hoc_commands.AdHocCommand.created_or_epoch',
|
@mock.patch('awx.main.models.ad_hoc_commands.AdHocCommand.created_or_epoch', Job.created)
|
||||||
Job.created)
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
'truncate, expected',
|
'truncate, expected',
|
||||||
|
|||||||
Reference in New Issue
Block a user