From 6dc1dd632af4f46e620ad5325daa552b1961b9ce Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Tue, 12 May 2015 15:38:24 -0400 Subject: [PATCH] require project field for openstack credential --- awx/main/models/credential.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/awx/main/models/credential.py b/awx/main/models/credential.py index 7b904c7975..31944e747b 100644 --- a/awx/main/models/credential.py +++ b/awx/main/models/credential.py @@ -215,6 +215,12 @@ class Credential(PasswordFieldsModel, CommonModelNameNotUnique): raise ValidationError('Password required for VMware credential.') return password + def clean_project(self): + project = self.project or '' + if self.kind == 'openstack' and not project: + raise ValidationError('Project name required for OpenStack credential.') + return project + def _validate_ssh_private_key(self, data): """Validate that the given SSH private key or certificate is, in fact, valid.