Make sure domains are enabled by default

Domains without an explicit 'enabled' key in the dict will now be
handled in the same way as projects are. This will ensure that
the KVS backend produces the same result as the SQL backend for
assignment.

Change-Id: I3b6d26278329841cfe1be5ce7f67ba6d3569785f
Related-Bug: #1311142
This commit is contained in:
Morgan Fainberg 2014-06-11 21:44:29 -07:00
parent fb0e4c5ef1
commit 091730c4ae
2 changed files with 8 additions and 0 deletions

View File

@ -302,6 +302,8 @@ class Manager(manager.Manager):
@notifications.created('domain')
def create_domain(self, domain_id, domain):
domain.setdefault('enabled', True)
domain['enabled'] = clean.domain_enabled(domain['enabled'])
ret = self.driver.create_domain(domain_id, domain)
if SHOULD_CACHE(ret):
self.get_domain.set(ret, self, domain_id)
@ -318,6 +320,8 @@ class Manager(manager.Manager):
@notifications.updated('domain')
def update_domain(self, domain_id, domain):
if 'enabled' in domain:
domain['enabled'] = clean.domain_enabled(domain['enabled'])
ret = self.driver.update_domain(domain_id, domain)
# disable owned users & projects when the API user specifically set
# enabled=False

View File

@ -63,6 +63,10 @@ def domain_name(name):
return check_name('Domain', name)
def domain_enabled(enabled):
return check_enabled('Domain', enabled)
def project_name(name):
return check_name('Project', name)