mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-13 15:58:41 -05:00
Merge branch 'devel' of github.com:ansible/ansible-tower into rbac
This commit is contained in:
@@ -40,7 +40,6 @@ class Credential(PasswordFieldsModel, CommonModelNameNotUnique, ResourceMixin):
|
||||
('gce', _('Google Compute Engine')),
|
||||
('azure', _('Microsoft Azure')),
|
||||
('openstack', _('OpenStack')),
|
||||
('openstack_v3', _('OpenStack V3')),
|
||||
]
|
||||
|
||||
BECOME_METHOD_CHOICES = [
|
||||
@@ -237,18 +236,12 @@ class Credential(PasswordFieldsModel, CommonModelNameNotUnique, ResourceMixin):
|
||||
host = self.host or ''
|
||||
if not host and self.kind == 'vmware':
|
||||
raise ValidationError('Host required for VMware credential.')
|
||||
if not host and self.kind in ('openstack', 'openstack_v3'):
|
||||
if not host and self.kind == 'openstack':
|
||||
raise ValidationError('Host required for OpenStack credential.')
|
||||
return host
|
||||
|
||||
def clean_domain(self):
|
||||
"""For case of Keystone v3 identity service that requires a
|
||||
`domain`, that a domain is provided.
|
||||
"""
|
||||
domain = self.domain or ''
|
||||
if not domain and self.kind == 'openstack_v3':
|
||||
raise ValidationError('Domain required for OpenStack with Keystone v3.')
|
||||
return domain
|
||||
return self.domain or ''
|
||||
|
||||
def clean_username(self):
|
||||
username = self.username or ''
|
||||
@@ -259,7 +252,7 @@ class Credential(PasswordFieldsModel, CommonModelNameNotUnique, ResourceMixin):
|
||||
'credential.')
|
||||
if not username and self.kind == 'vmware':
|
||||
raise ValidationError('Username required for VMware credential.')
|
||||
if not username and self.kind in ('openstack', 'openstack_v3'):
|
||||
if not username and self.kind == 'openstack':
|
||||
raise ValidationError('Username required for OpenStack credential.')
|
||||
return username
|
||||
|
||||
@@ -271,13 +264,13 @@ class Credential(PasswordFieldsModel, CommonModelNameNotUnique, ResourceMixin):
|
||||
raise ValidationError('API key required for Rackspace credential.')
|
||||
if not password and self.kind == 'vmware':
|
||||
raise ValidationError('Password required for VMware credential.')
|
||||
if not password and self.kind in ('openstack', 'openstack_v3'):
|
||||
if not password and self.kind == 'openstack':
|
||||
raise ValidationError('Password or API key required for OpenStack credential.')
|
||||
return password
|
||||
|
||||
def clean_project(self):
|
||||
project = self.project or ''
|
||||
if self.kind in ('openstack', 'openstack_v3') and not project:
|
||||
if self.kind == 'openstack' and not project:
|
||||
raise ValidationError('Project name required for OpenStack credential.')
|
||||
return project
|
||||
|
||||
|
||||
Reference in New Issue
Block a user