mirror of
https://github.com/ansible/awx.git
synced 2026-05-14 21:07:39 -02:30
Update Django to 1.8 and DRF to 3.3, add new Django migrations, update serializers/pagination/metadata, update browsable API styling.
This commit is contained in:
@@ -30,9 +30,6 @@ __all__ = ['AdHocCommand', 'AdHocCommandEvent']
|
||||
|
||||
class AdHocCommand(UnifiedJob):
|
||||
|
||||
MODULE_NAME_CHOICES = [(x,x) for x in tower_settings.AD_HOC_COMMANDS]
|
||||
MODULE_NAME_DEFAULT = 'command' if 'command' in tower_settings.AD_HOC_COMMANDS else None
|
||||
|
||||
class Meta(object):
|
||||
app_label = 'main'
|
||||
|
||||
@@ -61,9 +58,8 @@ class AdHocCommand(UnifiedJob):
|
||||
)
|
||||
module_name = models.CharField(
|
||||
max_length=1024,
|
||||
default=MODULE_NAME_DEFAULT,
|
||||
choices=MODULE_NAME_CHOICES,
|
||||
blank=bool(MODULE_NAME_DEFAULT),
|
||||
default='',
|
||||
blank=True,
|
||||
)
|
||||
module_args = models.TextField(
|
||||
blank=True,
|
||||
@@ -88,6 +84,12 @@ class AdHocCommand(UnifiedJob):
|
||||
through='AdHocCommandEvent',
|
||||
)
|
||||
|
||||
def clean_inventory(self):
|
||||
inv = self.inventory
|
||||
if not inv or not inv.active:
|
||||
raise ValidationError('Inventory is no longer available.')
|
||||
return inv
|
||||
|
||||
def clean_credential(self):
|
||||
cred = self.credential
|
||||
if cred and cred.kind != 'ssh':
|
||||
|
||||
Reference in New Issue
Block a user