mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
fix server error using 2 creds of same type
This commit is contained in:
committed by
Ryan Petrello
parent
331e272be0
commit
8b3e49cb24
@@ -3172,8 +3172,8 @@ class JobTemplateCredentialsList(SubListCreateAttachDetachAPIView):
|
|||||||
|
|
||||||
def is_valid_relation(self, parent, sub, created=False):
|
def is_valid_relation(self, parent, sub, created=False):
|
||||||
if sub.unique_hash() in [cred.unique_hash() for cred in parent.credentials.all()]:
|
if sub.unique_hash() in [cred.unique_hash() for cred in parent.credentials.all()]:
|
||||||
return {"error": _("Cannot assign multiple {credential_type} credentials.".format(
|
return {"error": _("Cannot assign multiple {credential_type} credentials.").format(
|
||||||
credential_type=sub.unique_hash(display=True)))}
|
credential_type=sub.unique_hash(display=True))}
|
||||||
kind = sub.credential_type.kind
|
kind = sub.credential_type.kind
|
||||||
if kind not in ('ssh', 'vault', 'cloud', 'net'):
|
if kind not in ('ssh', 'vault', 'cloud', 'net'):
|
||||||
return {'error': _('Cannot assign a Credential of kind `{}`.').format(kind)}
|
return {'error': _('Cannot assign a Credential of kind `{}`.').format(kind)}
|
||||||
|
|||||||
Reference in New Issue
Block a user