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