mirror of
https://github.com/ansible/awx.git
synced 2026-02-19 04:00:06 -03:30
Serialize Workflow Job Template inventories by natural key - related #7798
This changeset introduces two changes: 1. Update the API representation of Workflow Job Templates to use the natural key of the Inventory type instead of its id; 2. Override the related property of the CLI's WorkflowJobTemplate page type to patch the related references during the export process, allowing the resource to be serialised using the natural key of the Inventory type instead of the id. Change n.2 is a workaround that is used when exporting resources from AWX/Tower instances that don't have change n.1. It can be removed in the future.
This commit is contained in:
committed by
Jeff Bradberry
parent
a1700404cd
commit
32c08a09c3
@@ -3438,6 +3438,12 @@ class WorkflowJobTemplateSerializer(JobTemplateMixin, LabelsListMixin, UnifiedJo
|
||||
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})
|
||||
if obj.inventory:
|
||||
res['inventory'] = self.reverse(
|
||||
'api:inventory_detail', kwargs={
|
||||
'pk': obj.inventory.pk
|
||||
}
|
||||
)
|
||||
return res
|
||||
|
||||
def validate_extra_vars(self, value):
|
||||
|
||||
Reference in New Issue
Block a user