mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 02:50:02 -03:30
adds Playbook & AdHoc Diff
This commit is contained in:
parent
d57bc3b59c
commit
ecef799a5a
@ -2585,7 +2585,7 @@ class AdHocCommandSerializer(UnifiedJobSerializer):
|
||||
model = AdHocCommand
|
||||
fields = ('*', 'job_type', 'inventory', 'limit', 'credential',
|
||||
'module_name', 'module_args', 'forks', 'verbosity', 'extra_vars',
|
||||
'become_enabled', '-unified_job_template', '-description')
|
||||
'become_enabled', 'diff_mode', '-unified_job_template', '-description')
|
||||
extra_kwargs = {
|
||||
'name': {
|
||||
'read_only': True,
|
||||
|
||||
@ -21,4 +21,9 @@ class Migration(migrations.Migration):
|
||||
name='diff_mode',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='adhoccommand',
|
||||
name='diff_mode',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
||||
|
||||
@ -34,6 +34,9 @@ class AdHocCommand(UnifiedJob, JobNotificationMixin):
|
||||
class Meta(object):
|
||||
app_label = 'main'
|
||||
|
||||
diff_mode = models.BooleanField(
|
||||
default=False,
|
||||
)
|
||||
job_type = models.CharField(
|
||||
max_length=64,
|
||||
choices=AD_HOC_JOB_TYPE_CHOICES,
|
||||
@ -195,7 +198,7 @@ class AdHocCommand(UnifiedJob, JobNotificationMixin):
|
||||
data = {}
|
||||
for field in ('job_type', 'inventory_id', 'limit', 'credential_id',
|
||||
'module_name', 'module_args', 'forks', 'verbosity',
|
||||
'extra_vars', 'become_enabled'):
|
||||
'extra_vars', 'become_enabled', 'diff_mode'):
|
||||
data[field] = getattr(self, field)
|
||||
return AdHocCommand.objects.create(**data)
|
||||
|
||||
|
||||
@ -2011,10 +2011,10 @@ class RunAdHocCommand(BaseTask):
|
||||
|
||||
if ad_hoc_command.forks: # FIXME: Max limit?
|
||||
args.append('--forks=%d' % ad_hoc_command.forks)
|
||||
if ad_hoc_command.diff_mode:
|
||||
args.append('--diff')
|
||||
if ad_hoc_command.verbosity:
|
||||
args.append('-%s' % ('v' * min(5, ad_hoc_command.verbosity)))
|
||||
# if ad_hoc_command.diff_mode:
|
||||
# args.append('--diff')
|
||||
|
||||
if ad_hoc_command.extra_vars_dict:
|
||||
args.extend(['-e', json.dumps(ad_hoc_command.extra_vars_dict)])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user