Fix list_limit doesn't work correctly for domain
This patch changed the sql query for domain list to ensure the return count is correct if list_limit is set for resource. Closes-bug: #1760521 Change-Id: I690a9815fe2c35e6191ab3ac789e34736e0d637c
This commit is contained in:
parent
c522fc3bb7
commit
245a0c718b
@ -81,9 +81,9 @@ class Resource(base.ResourceDriverBase):
|
||||
f['value'] = base.NULL_DOMAIN_ID
|
||||
with sql.session_for_read() as session:
|
||||
query = session.query(Project)
|
||||
query = query.filter(Project.id != base.NULL_DOMAIN_ID)
|
||||
project_refs = sql.filter_limit_query(Project, query, hints)
|
||||
return [project_ref.to_dict() for project_ref in project_refs
|
||||
if not self._is_hidden_ref(project_ref)]
|
||||
return [project_ref.to_dict() for project_ref in project_refs]
|
||||
|
||||
def list_projects_from_ids(self, ids):
|
||||
if not ids:
|
||||
|
@ -24,7 +24,6 @@ from keystone import exception
|
||||
from keystone.tests import unit
|
||||
from keystone.tests.unit import default_fixtures
|
||||
from keystone.tests.unit import filtering
|
||||
from keystone.tests.unit import utils as test_utils
|
||||
|
||||
|
||||
CONF = keystone.conf.CONF
|
||||
@ -1107,8 +1106,6 @@ class IdentityTests(object):
|
||||
matchers.StartsWith('domaingroup1'))
|
||||
|
||||
@unit.skip_if_no_multiple_domains_support
|
||||
@test_utils.wip('The root domain throws off the limit count by one',
|
||||
bug='#1760521')
|
||||
def test_list_limit_for_domains(self):
|
||||
def create_domains(count):
|
||||
for _ in range(count):
|
||||
|
@ -151,8 +151,6 @@ class ResourceTestCase(test_v3.RestfulTestCase,
|
||||
resource_url=resource_url)
|
||||
self.head(resource_url, expected_status=http_client.OK)
|
||||
|
||||
@test_utils.wip('The root domain throws off the limit count by one',
|
||||
bug='#1760521')
|
||||
def test_list_limit_for_domains(self):
|
||||
PROVIDERS.resource_api.create_domain(
|
||||
default_fixtures.ROOT_DOMAIN['id'], default_fixtures.ROOT_DOMAIN
|
||||
|
6
releasenotes/notes/bug-1760521-fec5c88af214401f.yaml
Normal file
6
releasenotes/notes/bug-1760521-fec5c88af214401f.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
[`bug 1760521 <https://bugs.launchpad.net/keystone/+bug/1760521>`_]
|
||||
Fixed the bug that the result count for ``domain list`` may lack one if
|
||||
the config option ``list_limit`` in [resource] is set.
|
Loading…
Reference in New Issue
Block a user