Unimplemented error on V3 get token

Configuring keystone on V3 with LDAP configured for Assignment and
Identity. When you try to obtain the token (using CURL ie), the keystone
server raises an unimplemented exception. You can see how to reproduce
this on the description's bug.

This is caused because, when you make logging on keystone it assign to
the validate user the 'default' domain (thats because LDAP is
single-domain backend). In the LDAP backend, one of the functions
involved on this workflow is not implemented.

Change-Id: I04faddf888f66978bfe5a330140f8fac9b961a5a
Closes-Bug: #1277463
This commit is contained in:
Marcos Lobo 2014-02-07 13:51:18 +01:00
parent c32fe003e7
commit 60a570e2bb
3 changed files with 31 additions and 1 deletions

View File

@ -385,7 +385,10 @@ class Assignment(assignment.Driver):
inherited_to_projects)]
def get_domain_by_name(self, domain_name):
raise exception.NotImplemented()
default_domain = assignment.calc_default_domain()
if domain_name != default_domain['name']:
raise exception.DomainNotFound(domain_id=domain_name)
return default_domain
def list_role_assignments(self):
role_assignments = []

View File

@ -2887,6 +2887,21 @@ class IdentityTests(object):
group_id=uuid.uuid4().hex,
project_id=self.tenant_bar['id'])
def test_get_default_domain_by_name(self):
domain_name = 'default'
domain = {'id': uuid.uuid4().hex, 'name': domain_name, 'enabled': True}
self.assignment_api.create_domain(domain['id'], domain)
domain_ref = self.assignment_api.get_domain_by_name(domain_name)
self.assertEqual(domain_ref, domain)
def test_get_not_default_domain_by_name(self):
domain_name = 'foo'
self.assertRaises(exception.DomainNotFound,
self.assignment_api.get_domain_by_name,
domain_name)
class TokenTests(object):
def _create_token_id(self):

View File

@ -1103,6 +1103,18 @@ class LDAPIdentity(tests.TestCase, BaseLDAPIdentity):
def test_create_grant_no_group(self):
self.skipTest('Blocked by bug 1101287')
def test_get_default_domain_by_name(self):
domain = self._get_domain_fixture()
domain_ref = self.assignment_api.get_domain_by_name(domain['name'])
self.assertEqual(domain_ref, domain)
def test_get_not_default_domain_by_name(self):
domain_name = 'foo'
self.assertRaises(exception.DomainNotFound,
self.assignment_api.get_domain_by_name,
domain_name)
class LDAPIdentityEnabledEmulation(LDAPIdentity):
def setUp(self):