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
This commit is contained in:
parent
02f492ae4c
commit
dfd37a2e6e
@ -38,7 +38,7 @@ jmespath==0.9.0
|
||||
jsonpatch==1.16
|
||||
jsonpointer==1.13
|
||||
jsonschema==2.6.0
|
||||
keystoneauth1==3.4.0
|
||||
keystoneauth1==3.6.2
|
||||
kombu==4.0.0
|
||||
linecache2==1.0.0
|
||||
MarkupSafe==1.0
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
"""Versions Action Implementation"""
|
||||
|
||||
import os_service_types
|
||||
from osc_lib.command import command
|
||||
|
||||
from openstackclient.i18n import _
|
||||
@ -67,7 +66,8 @@ class ShowVersions(command.Lister):
|
||||
session = self.app.client_manager.session
|
||||
version_data = session.get_all_version_data(
|
||||
interface=interface,
|
||||
region_name=parsed_args.region_name)
|
||||
region_name=parsed_args.region_name,
|
||||
service_type=parsed_args.service)
|
||||
|
||||
columns = [
|
||||
"Region Name",
|
||||
@ -83,22 +83,10 @@ class ShowVersions(command.Lister):
|
||||
if status:
|
||||
status = status.upper()
|
||||
|
||||
service = parsed_args.service
|
||||
if service:
|
||||
# Normalize service type argument to official type
|
||||
service_type_manager = os_service_types.ServiceTypes()
|
||||
service = service_type_manager.get_service_type(service)
|
||||
|
||||
versions = []
|
||||
for region_name, interfaces in version_data.items():
|
||||
for interface, services in interfaces.items():
|
||||
for service_type, service_versions in services.items():
|
||||
if service and service != service_type:
|
||||
# TODO(mordred) Once there is a version of
|
||||
# keystoneauth that can do this filtering
|
||||
# before making all the discovery calls, switch
|
||||
# to that.
|
||||
continue
|
||||
for data in service_versions:
|
||||
if status and status != data['status']:
|
||||
continue
|
||||
|
@ -6,7 +6,7 @@ six>=1.10.0 # MIT
|
||||
|
||||
Babel!=2.4.0,>=2.3.4 # BSD
|
||||
cliff!=2.9.0,>=2.8.0 # Apache-2.0
|
||||
keystoneauth1>=3.4.0 # Apache-2.0
|
||||
keystoneauth1>=3.6.2 # Apache-2.0
|
||||
openstacksdk>=0.17.0 # Apache-2.0
|
||||
osc-lib>=1.10.0 # Apache-2.0
|
||||
oslo.i18n>=3.15.3 # Apache-2.0
|
||||
|
Loading…
Reference in New Issue
Block a user