Skip to content

Commit dfd37a2

Browse files
committed
Make use of keystoneauth service-type filtering for versions
The first version of the versions show command does client-side service-type filtering, which while functional, causes many more API calls than needed. Now that keystoneauth supports the filtering at the source, use it. Change-Id: I57c49e67f9cb285a5f5bc19ec53a42d10de9f0da
1 parent 02f492a commit dfd37a2

3 files changed

Lines changed: 4 additions & 16 deletions

File tree

lower-constraints.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jmespath==0.9.0
3838
jsonpatch==1.16
3939
jsonpointer==1.13
4040
jsonschema==2.6.0
41-
keystoneauth1==3.4.0
41+
keystoneauth1==3.6.2
4242
kombu==4.0.0
4343
linecache2==1.0.0
4444
MarkupSafe==1.0

openstackclient/common/versions.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
"""Versions Action Implementation"""
1616

17-
import os_service_types
1817
from osc_lib.command import command
1918

2019
from openstackclient.i18n import _
@@ -67,7 +66,8 @@ def take_action(self, parsed_args):
6766
session = self.app.client_manager.session
6867
version_data = session.get_all_version_data(
6968
interface=interface,
70-
region_name=parsed_args.region_name)
69+
region_name=parsed_args.region_name,
70+
service_type=parsed_args.service)
7171

7272
columns = [
7373
"Region Name",
@@ -83,22 +83,10 @@ def take_action(self, parsed_args):
8383
if status:
8484
status = status.upper()
8585

86-
service = parsed_args.service
87-
if service:
88-
# Normalize service type argument to official type
89-
service_type_manager = os_service_types.ServiceTypes()
90-
service = service_type_manager.get_service_type(service)
91-
9286
versions = []
9387
for region_name, interfaces in version_data.items():
9488
for interface, services in interfaces.items():
9589
for service_type, service_versions in services.items():
96-
if service and service != service_type:
97-
# TODO(mordred) Once there is a version of
98-
# keystoneauth that can do this filtering
99-
# before making all the discovery calls, switch
100-
# to that.
101-
continue
10290
for data in service_versions:
10391
if status and status != data['status']:
10492
continue

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ six>=1.10.0 # MIT
66

77
Babel!=2.4.0,>=2.3.4 # BSD
88
cliff!=2.9.0,>=2.8.0 # Apache-2.0
9-
keystoneauth1>=3.4.0 # Apache-2.0
9+
keystoneauth1>=3.6.2 # Apache-2.0
1010
openstacksdk>=0.17.0 # Apache-2.0
1111
osc-lib>=1.10.0 # Apache-2.0
1212
oslo.i18n>=3.15.3 # Apache-2.0

0 commit comments

Comments
 (0)