Merge "add missing kvs functionality (bug1119770)"
This commit is contained in:
commit
03d17eefe6
@ -63,8 +63,9 @@ class Identity(kvs.Base, identity.Driver):
|
||||
except exception.NotFound:
|
||||
raise exception.ProjectNotFound(project_id=tenant_id)
|
||||
|
||||
def get_projects(self):
|
||||
tenant_keys = filter(lambda x: x.startswith("tenant-"), self.db.keys())
|
||||
def list_projects(self):
|
||||
tenant_keys = filter(lambda x: x.startswith("tenant-"),
|
||||
self.db.keys())
|
||||
return [self.db.get(key) for key in tenant_keys]
|
||||
|
||||
def get_project_by_name(self, tenant_name, domain_id):
|
||||
@ -77,7 +78,8 @@ class Identity(kvs.Base, identity.Driver):
|
||||
self.get_project(tenant_id)
|
||||
user_keys = filter(lambda x: x.startswith("user-"), self.db.keys())
|
||||
user_refs = [self.db.get(key) for key in user_keys]
|
||||
return filter(lambda x: tenant_id in x['tenants'], user_refs)
|
||||
user_refs = filter(lambda x: tenant_id in x['tenants'], user_refs)
|
||||
return [identity.filter_user(user_ref) for user_ref in user_refs]
|
||||
|
||||
def _get_user(self, user_id):
|
||||
try:
|
||||
@ -539,7 +541,8 @@ class Identity(kvs.Base, identity.Driver):
|
||||
return domain
|
||||
|
||||
def list_domains(self):
|
||||
return self.db.get('domain_list', [])
|
||||
domain_ids = self.db.get('domain_list', [])
|
||||
return [self.get_domain(x) for x in domain_ids]
|
||||
|
||||
def get_domain(self, domain_id):
|
||||
try:
|
||||
@ -580,7 +583,8 @@ class Identity(kvs.Base, identity.Driver):
|
||||
return group
|
||||
|
||||
def list_groups(self):
|
||||
return self.db.get('group_list', [])
|
||||
group_ids = self.db.get('group_list', [])
|
||||
return [self.get_group(x) for x in group_ids]
|
||||
|
||||
def get_group(self, group_id):
|
||||
try:
|
||||
|
@ -103,7 +103,7 @@ class Identity(identity.Driver):
|
||||
except exception.NotFound:
|
||||
raise exception.ProjectNotFound(project_id=tenant_id)
|
||||
|
||||
def get_projects(self):
|
||||
def list_projects(self):
|
||||
return self.project.get_all()
|
||||
|
||||
def get_project_by_name(self, tenant_name, domain_id):
|
||||
|
@ -102,9 +102,6 @@ class PamIdentity(identity.Driver):
|
||||
def remove_user_from_project(self, tenant_id, user_id):
|
||||
pass
|
||||
|
||||
def get_all_projects(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
def get_projects_for_user(self, user_id):
|
||||
return [user_id]
|
||||
|
||||
|
@ -406,14 +406,11 @@ class Identity(sql.Base, identity.Driver):
|
||||
session.delete(membership_ref)
|
||||
session.flush()
|
||||
|
||||
def get_projects(self):
|
||||
def list_projects(self):
|
||||
session = self.get_session()
|
||||
tenant_refs = session.query(Project).all()
|
||||
return [tenant_ref.to_dict() for tenant_ref in tenant_refs]
|
||||
|
||||
def list_projects(self):
|
||||
return self.get_projects()
|
||||
|
||||
def get_projects_for_user(self, user_id):
|
||||
session = self.get_session()
|
||||
self.get_user(user_id)
|
||||
|
@ -39,7 +39,7 @@ class Tenant(controller.V2Controller):
|
||||
context, context['query_string'].get('name'))
|
||||
|
||||
self.assert_admin(context)
|
||||
tenant_refs = self.identity_api.get_projects(context)
|
||||
tenant_refs = self.identity_api.list_projects(context)
|
||||
for tenant_ref in tenant_refs:
|
||||
tenant_ref = self._filter_domain_id(tenant_ref)
|
||||
params = {
|
||||
|
@ -119,23 +119,10 @@ class Driver(object):
|
||||
"""
|
||||
raise exception.NotImplemented()
|
||||
|
||||
def get_all_projects(self):
|
||||
"""FIXME(dolph): Lists all tenants in the system? I'm not sure how this
|
||||
is different from get_projects, why get_projects isn't
|
||||
documented as part of the driver, or why it's called
|
||||
get_projects instead of list_projects (i.e. list_roles
|
||||
and list_users)...
|
||||
|
||||
:returns: a list of ... FIXME(dolph): tenant_refs or tenant_id's?
|
||||
|
||||
"""
|
||||
raise exception.NotImplemented()
|
||||
|
||||
def get_project_users(self, tenant_id):
|
||||
"""FIXME(dolph): Lists all users with a relationship to the specified
|
||||
tenant?
|
||||
"""Lists all users with a relationship to the specified project.
|
||||
|
||||
:returns: a list of ... FIXME(dolph): user_refs or user_id's?
|
||||
:returns: a list of user_refs or an empty set.
|
||||
:raises: keystone.exception.ProjectNotFound
|
||||
|
||||
"""
|
||||
@ -303,6 +290,14 @@ class Driver(object):
|
||||
"""
|
||||
raise exception.NotImplemented()
|
||||
|
||||
def list_user_projects(self, user_id):
|
||||
"""List all projects associated with a given user.
|
||||
|
||||
:returns: a list of project_refs or an empty list.
|
||||
|
||||
"""
|
||||
raise exception.NotImplemented()
|
||||
|
||||
def get_project(self):
|
||||
"""Get a project by ID.
|
||||
|
||||
|
@ -1397,12 +1397,6 @@ class IdentityTests(object):
|
||||
for test_role in default_fixtures.ROLES:
|
||||
self.assertTrue(x for x in roles if x['id'] == test_role['id'])
|
||||
|
||||
def test_get_projects(self):
|
||||
tenants = self.identity_api.get_projects()
|
||||
for test_project in default_fixtures.TENANTS:
|
||||
self.assertTrue(x for x in tenants
|
||||
if x['id'] == test_project['id'])
|
||||
|
||||
def test_delete_project_with_role_assignments(self):
|
||||
tenant = {'id': uuid.uuid4().hex, 'name': uuid.uuid4().hex,
|
||||
'domain_id': DEFAULT_DOMAIN_ID}
|
||||
|
@ -34,18 +34,7 @@ class KvsIdentity(test.TestCase, test_backend.IdentityTests):
|
||||
self.load_fixtures(default_fixtures)
|
||||
|
||||
def test_list_user_projects(self):
|
||||
raise nose.exc.SkipTest('Blocked by bug 1119770')
|
||||
|
||||
def test_list_projects(self):
|
||||
raise nose.exc.SkipTest('Blocked by bug 1119770')
|
||||
|
||||
def test_list_groups(self):
|
||||
raise nose.exc.SkipTest('Blocked by bug 1119770')
|
||||
|
||||
def test_list_domains(self):
|
||||
raise nose.exc.SkipTest('Blocked by bug 1119770')
|
||||
|
||||
def test_get_project_users(self):
|
||||
# NOTE(chungg): not implemented
|
||||
raise nose.exc.SkipTest('Blocked by bug 1119770')
|
||||
|
||||
|
||||
|
@ -45,17 +45,6 @@ class LDAPIdentity(test.TestCase, test_backend.IdentityTests):
|
||||
self.identity_api = identity_ldap.Identity()
|
||||
self.load_fixtures(default_fixtures)
|
||||
|
||||
def test_role_crud(self):
|
||||
role = {'id': uuid.uuid4().hex, 'name': uuid.uuid4().hex}
|
||||
self.identity_api.create_role(role['id'], role)
|
||||
role_ref = self.identity_api.get_role(role['id'])
|
||||
role_ref_dict = dict((x, role_ref[x]) for x in role_ref)
|
||||
self.assertDictEqual(role_ref_dict, role)
|
||||
self.identity_api.delete_role(role['id'])
|
||||
self.assertRaises(exception.RoleNotFound,
|
||||
self.identity_api.get_role,
|
||||
role['id'])
|
||||
|
||||
def test_build_tree(self):
|
||||
"""Regression test for building the tree names
|
||||
"""
|
||||
@ -494,16 +483,13 @@ class LDAPIdentity(test.TestCase, test_backend.IdentityTests):
|
||||
raise nose.exc.SkipTest('Blocked by bug 1101287')
|
||||
|
||||
def test_list_groups(self):
|
||||
raise nose.exc.SkipTest('Blocked by bug 1122354')
|
||||
raise nose.exc.SkipTest('Blocked by bug 1092187')
|
||||
|
||||
def test_list_domains(self):
|
||||
raise nose.exc.SkipTest('Blocked by bug 1122354')
|
||||
|
||||
def test_list_projects(self):
|
||||
raise nose.exc.SkipTest('Blocked by bug 1122354')
|
||||
raise nose.exc.SkipTest('Blocked by bug 1101276')
|
||||
|
||||
def test_list_user_projects(self):
|
||||
raise nose.exc.SkipTest('Blocked by bug 1122354')
|
||||
raise nose.exc.SkipTest('Blocked by bug 1101287')
|
||||
|
||||
def test_get_project_users(self):
|
||||
raise nose.exc.SkipTest('Blocked by bug 1122354')
|
||||
raise nose.exc.SkipTest('Blocked by bug 1101287')
|
||||
|
@ -509,7 +509,7 @@ class CoreApiTests(object):
|
||||
def test_invalid_parameter_error_response(self):
|
||||
token = self.get_scoped_token()
|
||||
bad_body = {
|
||||
'OS-KSADM:serviceBAD': {
|
||||
'OS-KSADM:service%s' % uuid.uuid4().hex: {
|
||||
'name': uuid.uuid4().hex,
|
||||
'type': uuid.uuid4().hex,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user