mirror of
https://github.com/ansible/awx.git
synced 2026-02-28 08:18:43 -03:30
Merge pull request #3624 from chrismeyersfsu/improvement-allow_simultaneous
Improvement allow simultaneous
This commit is contained in:
@@ -1953,7 +1953,8 @@ class JobSerializer(UnifiedJobSerializer, JobOptionsSerializer):
|
|||||||
model = Job
|
model = Job
|
||||||
fields = ('*', 'job_template', 'passwords_needed_to_start', 'ask_variables_on_launch',
|
fields = ('*', 'job_template', 'passwords_needed_to_start', 'ask_variables_on_launch',
|
||||||
'ask_limit_on_launch', 'ask_tags_on_launch', 'ask_skip_tags_on_launch',
|
'ask_limit_on_launch', 'ask_tags_on_launch', 'ask_skip_tags_on_launch',
|
||||||
'ask_job_type_on_launch', 'ask_inventory_on_launch', 'ask_credential_on_launch')
|
'ask_job_type_on_launch', 'ask_inventory_on_launch', 'ask_credential_on_launch',
|
||||||
|
'allow_simultaneous',)
|
||||||
|
|
||||||
def get_related(self, obj):
|
def get_related(self, obj):
|
||||||
res = super(JobSerializer, self).get_related(obj)
|
res = super(JobSerializer, self).get_related(obj)
|
||||||
|
|||||||
19
awx/main/migrations/0037_job_allow_simultaneous.py
Normal file
19
awx/main/migrations/0037_job_allow_simultaneous.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('main', '0036_v310_remove_tower_settings'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='job',
|
||||||
|
name='allow_simultaneous',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -138,6 +138,9 @@ class JobOptions(BaseModel):
|
|||||||
become_enabled = models.BooleanField(
|
become_enabled = models.BooleanField(
|
||||||
default=False,
|
default=False,
|
||||||
)
|
)
|
||||||
|
allow_simultaneous = models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
)
|
||||||
|
|
||||||
extra_vars_dict = VarsDictProperty('extra_vars', True)
|
extra_vars_dict = VarsDictProperty('extra_vars', True)
|
||||||
|
|
||||||
@@ -236,9 +239,6 @@ class JobTemplate(UnifiedJobTemplate, JobOptions, ResourceMixin):
|
|||||||
read_role = ImplicitRoleField(
|
read_role = ImplicitRoleField(
|
||||||
parent_role=['project.organization.auditor_role', 'inventory.organization.auditor_role', 'execute_role', 'admin_role'],
|
parent_role=['project.organization.auditor_role', 'inventory.organization.auditor_role', 'execute_role', 'admin_role'],
|
||||||
)
|
)
|
||||||
allow_simultaneous = models.BooleanField(
|
|
||||||
default=False,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -251,7 +251,7 @@ class JobTemplate(UnifiedJobTemplate, JobOptions, ResourceMixin):
|
|||||||
'playbook', 'credential', 'cloud_credential', 'network_credential', 'forks', 'schedule',
|
'playbook', 'credential', 'cloud_credential', 'network_credential', 'forks', 'schedule',
|
||||||
'limit', 'verbosity', 'job_tags', 'extra_vars', 'launch_type',
|
'limit', 'verbosity', 'job_tags', 'extra_vars', 'launch_type',
|
||||||
'force_handlers', 'skip_tags', 'start_at_task', 'become_enabled',
|
'force_handlers', 'skip_tags', 'start_at_task', 'become_enabled',
|
||||||
'labels', 'survey_passwords']
|
'labels', 'survey_passwords', 'allow_simultaneous',]
|
||||||
|
|
||||||
def resource_validation_data(self):
|
def resource_validation_data(self):
|
||||||
'''
|
'''
|
||||||
@@ -616,7 +616,7 @@ class Job(UnifiedJob, JobOptions, JobNotificationMixin):
|
|||||||
if obj.job_template is not None and obj.inventory is not None:
|
if obj.job_template is not None and obj.inventory is not None:
|
||||||
if obj.job_template == self.job_template and \
|
if obj.job_template == self.job_template and \
|
||||||
obj.inventory == self.inventory:
|
obj.inventory == self.inventory:
|
||||||
if self.job_template.allow_simultaneous:
|
if self.allow_simultaneous:
|
||||||
return False
|
return False
|
||||||
if obj.launch_type == 'callback' and self.launch_type == 'callback' and \
|
if obj.launch_type == 'callback' and self.launch_type == 'callback' and \
|
||||||
obj.limit != self.limit:
|
obj.limit != self.limit:
|
||||||
|
|||||||
Reference in New Issue
Block a user