mirror of
https://github.com/ansible/awx.git
synced 2026-05-09 10:27:37 -02:30
include credential in inventory update detail summary
This commit is contained in:
committed by
Ryan Petrello
parent
51d7de296f
commit
6bc5c4da74
@@ -2175,14 +2175,25 @@ class InventoryUpdateDetailSerializer(InventoryUpdateSerializer):
|
|||||||
|
|
||||||
def get_summary_fields(self, obj):
|
def get_summary_fields(self, obj):
|
||||||
summary_fields = super(InventoryUpdateDetailSerializer, self).get_summary_fields(obj)
|
summary_fields = super(InventoryUpdateDetailSerializer, self).get_summary_fields(obj)
|
||||||
summary_obj = self.get_source_project(obj)
|
|
||||||
|
|
||||||
if summary_obj:
|
source_project = self.get_source_project(obj)
|
||||||
|
if source_project:
|
||||||
summary_fields['source_project'] = {}
|
summary_fields['source_project'] = {}
|
||||||
for field in SUMMARIZABLE_FK_FIELDS['project']:
|
for field in SUMMARIZABLE_FK_FIELDS['project']:
|
||||||
value = getattr(summary_obj, field, None)
|
value = getattr(source_project, field, None)
|
||||||
if value is not None:
|
if value is not None:
|
||||||
summary_fields['source_project'][field] = value
|
summary_fields['source_project'][field] = value
|
||||||
|
|
||||||
|
cred = obj.credentials.first()
|
||||||
|
if cred:
|
||||||
|
summary_fields['credential'] = {
|
||||||
|
'id': cred.pk,
|
||||||
|
'name': cred.name,
|
||||||
|
'description': cred.description,
|
||||||
|
'kind': cred.kind,
|
||||||
|
'cloud': cred.credential_type.kind == 'cloud'
|
||||||
|
}
|
||||||
|
|
||||||
return summary_fields
|
return summary_fields
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user