mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 08:21:15 +03:00
remove job_type scan from options
* Need to keep the scan job in job_type for migrations so just remove it from the constructed OPTIONS
This commit is contained in:
parent
f31cec2848
commit
c11b870084
@ -236,3 +236,19 @@ class RoleMetadata(Metadata):
|
||||
"disassociate": {"type": "integer", "label": "Disassociate", "help_text": "Provide to remove this role."},
|
||||
}
|
||||
return metadata
|
||||
|
||||
|
||||
# TODO: Tower 3.3 remove class and all uses in views.py when API v1 is removed
|
||||
class JobTypeMetadata(Metadata):
|
||||
def get_field_info(self, field):
|
||||
res = super(JobTypeMetadata, self).get_field_info(field)
|
||||
|
||||
if field.field_name == 'job_type':
|
||||
index = 0
|
||||
for choice in res['choices']:
|
||||
if choice[0] == 'scan':
|
||||
res['choices'].pop(index)
|
||||
break
|
||||
index += 1
|
||||
return res
|
||||
|
||||
|
@ -78,7 +78,7 @@ from awx.main.utils.filters import SmartFilter
|
||||
from awx.api.permissions import * # noqa
|
||||
from awx.api.renderers import * # noqa
|
||||
from awx.api.serializers import * # noqa
|
||||
from awx.api.metadata import RoleMetadata
|
||||
from awx.api.metadata import RoleMetadata, JobTypeMetadata
|
||||
from awx.main.consumers import emit_channel_notification
|
||||
from awx.main.models.unified_jobs import ACTIVE_STATES
|
||||
from awx.main.scheduler.tasks import run_job_complete
|
||||
@ -2713,6 +2713,7 @@ class InventoryUpdateNotificationsList(SubListAPIView):
|
||||
class JobTemplateList(ListCreateAPIView):
|
||||
|
||||
model = JobTemplate
|
||||
metadata_class = JobTypeMetadata
|
||||
serializer_class = JobTemplateSerializer
|
||||
always_allow_superuser = False
|
||||
capabilities_prefetch = [
|
||||
@ -2731,6 +2732,7 @@ class JobTemplateList(ListCreateAPIView):
|
||||
class JobTemplateDetail(RetrieveUpdateDestroyAPIView):
|
||||
|
||||
model = JobTemplate
|
||||
metadata_class = JobTypeMetadata
|
||||
serializer_class = JobTemplateSerializer
|
||||
always_allow_superuser = False
|
||||
|
||||
@ -3731,12 +3733,14 @@ class SystemJobTemplateNotificationTemplatesSuccessList(SubListCreateAttachDetac
|
||||
class JobList(ListCreateAPIView):
|
||||
|
||||
model = Job
|
||||
metadata_class = JobTypeMetadata
|
||||
serializer_class = JobListSerializer
|
||||
|
||||
|
||||
class JobDetail(RetrieveUpdateDestroyAPIView):
|
||||
|
||||
model = Job
|
||||
metadata_class = JobTypeMetadata
|
||||
serializer_class = JobSerializer
|
||||
|
||||
def update(self, request, *args, **kwargs):
|
||||
|
Loading…
Reference in New Issue
Block a user