mirror of
https://github.com/ansible/awx.git
synced 2026-05-23 08:37:48 -02:30
Merge pull request #3837 from saito-hideki/issue/2891
Add credential info in expanded list view of inventory update Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
@@ -2007,17 +2007,22 @@ class InventorySourceOptionsSerializer(BaseSerializer):
|
|||||||
# TODO: remove when old 'credential' fields are removed
|
# TODO: remove when old 'credential' fields are removed
|
||||||
def get_summary_fields(self, obj):
|
def get_summary_fields(self, obj):
|
||||||
summary_fields = super(InventorySourceOptionsSerializer, self).get_summary_fields(obj)
|
summary_fields = super(InventorySourceOptionsSerializer, self).get_summary_fields(obj)
|
||||||
|
all_creds = []
|
||||||
if 'credential' in summary_fields:
|
if 'credential' in summary_fields:
|
||||||
cred = obj.get_cloud_credential()
|
cred = obj.get_cloud_credential()
|
||||||
if cred:
|
if cred:
|
||||||
summary_fields['credential'] = {
|
summarized_cred = {
|
||||||
'id': cred.id, 'name': cred.name, 'description': cred.description,
|
'id': cred.id, 'name': cred.name, 'description': cred.description,
|
||||||
'kind': cred.kind, 'cloud': True
|
'kind': cred.kind, 'cloud': True
|
||||||
}
|
}
|
||||||
|
summary_fields['credential'] = summarized_cred
|
||||||
|
all_creds.append(summarized_cred)
|
||||||
if self.version > 1:
|
if self.version > 1:
|
||||||
summary_fields['credential']['credential_type_id'] = cred.credential_type_id
|
summary_fields['credential']['credential_type_id'] = cred.credential_type_id
|
||||||
else:
|
else:
|
||||||
summary_fields.pop('credential')
|
summary_fields.pop('credential')
|
||||||
|
if self.version > 1:
|
||||||
|
summary_fields['credentials'] = all_creds
|
||||||
return summary_fields
|
return summary_fields
|
||||||
|
|
||||||
|
|
||||||
@@ -5116,4 +5121,3 @@ class ActivityStreamSerializer(BaseSerializer):
|
|||||||
if obj.setting:
|
if obj.setting:
|
||||||
summary_fields['setting'] = [obj.setting]
|
summary_fields['setting'] = [obj.setting]
|
||||||
return summary_fields
|
return summary_fields
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user