Fix openstack client for vmware-nsx

Do not use the client to get extensions in case the initialization
is not done. This can happen when using openstack client command
with --help

Change-Id: Iccdc47e3f7c53f6f1aa73bb18f85a522efd85093
This commit is contained in:
asarfaty 2020-03-26 12:43:29 +02:00
parent 1283390df9
commit f43adec123
1 changed files with 6 additions and 2 deletions

View File

@ -14,7 +14,6 @@
# under the License. # under the License.
from osc_lib import utils as osc_utils from osc_lib import utils as osc_utils
cached_extensions = None cached_extensions = None
@ -24,9 +23,14 @@ def get_extensions(client_manager):
global cached_extensions global cached_extensions
if cached_extensions is not None: if cached_extensions is not None:
return cached_extensions return cached_extensions
extensions = []
if not client_manager._auth_setup_completed:
# cannot get the extensions from the neutron client
return extensions
# Get supported extensions from the manager # Get supported extensions from the manager
data = client_manager.network.extensions() data = client_manager.network.extensions()
extensions = []
for s in data: for s in data:
prop = osc_utils.get_item_properties( prop = osc_utils.get_item_properties(
s, ('Alias',), formatters={}) s, ('Alias',), formatters={})