mirror of
https://github.com/ansible/awx.git
synced 2026-03-10 22:19:28 -02:30
Optionally add the webhook_credential link to related
on JTs and WFJTs.
This commit is contained in:
@@ -2900,6 +2900,8 @@ class JobTemplateSerializer(JobTemplateMixin, UnifiedJobTemplateSerializer, JobO
|
|||||||
res['callback'] = self.reverse('api:job_template_callback', kwargs={'pk': obj.pk})
|
res['callback'] = self.reverse('api:job_template_callback', kwargs={'pk': obj.pk})
|
||||||
if obj.organization_id:
|
if obj.organization_id:
|
||||||
res['organization'] = self.reverse('api:organization_detail', kwargs={'pk': obj.organization_id})
|
res['organization'] = self.reverse('api:organization_detail', kwargs={'pk': obj.organization_id})
|
||||||
|
if obj.webhook_credential_id:
|
||||||
|
res['webhook_credential'] = self.reverse('api:credential_detail', kwargs={'pk': obj.webhook_credential_id})
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def validate(self, attrs):
|
def validate(self, attrs):
|
||||||
@@ -3390,6 +3392,8 @@ class WorkflowJobTemplateSerializer(JobTemplateMixin, LabelsListMixin, UnifiedJo
|
|||||||
)
|
)
|
||||||
if obj.organization:
|
if obj.organization:
|
||||||
res['organization'] = self.reverse('api:organization_detail', kwargs={'pk': obj.organization.pk})
|
res['organization'] = self.reverse('api:organization_detail', kwargs={'pk': obj.organization.pk})
|
||||||
|
if obj.webhook_credential_id:
|
||||||
|
res['webhook_credential'] = self.reverse('api:credential_detail', kwargs={'pk': obj.webhook_credential_id})
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def validate_extra_vars(self, value):
|
def validate_extra_vars(self, value):
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ def job_template(mocker):
|
|||||||
mock_jt.validation_errors = mock_JT_resource_data
|
mock_jt.validation_errors = mock_JT_resource_data
|
||||||
mock_jt.webhook_service = ''
|
mock_jt.webhook_service = ''
|
||||||
mock_jt.organization_id = None
|
mock_jt.organization_id = None
|
||||||
|
mock_jt.webhook_credential_id = None
|
||||||
return mock_jt
|
return mock_jt
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user