mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 02:19:58 -03:30
fix a bug introduced in the inventory source detail API by v1 removal
see: https://github.com/ansible/awx/issues/4059
This commit is contained in:
parent
e1d60ff4f1
commit
ae9032ce03
@ -1943,6 +1943,25 @@ class InventorySourceOptionsSerializer(BaseSerializer):
|
||||
|
||||
return super(InventorySourceOptionsSerializer, self).validate(attrs)
|
||||
|
||||
# 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:
|
||||
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)
|
||||
summary_fields['credential']['credential_type_id'] = cred.credential_type_id
|
||||
else:
|
||||
summary_fields.pop('credential')
|
||||
summary_fields['credentials'] = all_creds
|
||||
return summary_fields
|
||||
|
||||
|
||||
class InventorySourceSerializer(UnifiedJobTemplateSerializer, InventorySourceOptionsSerializer):
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user