Rework clientmanager

* Add compatibility for plugin v2 interface removed from osc-lib
* ClientManager.is_network_endpoint_enabled() is wrapper for
  new is_service_available()

Change-Id: I6f26ce9e4d0702f50c7949bacfbeeb0f98cddb5d
This commit is contained in:
Dean Troyer
2016-05-13 16:53:44 -05:00
committed by Steve Martinelli
parent 719c5d79ce
commit f38c51c1b9
3 changed files with 53 additions and 598 deletions
openstackclient

@ -26,6 +26,7 @@ from cliff import app
from cliff import command
from cliff import complete
from cliff import help
from osc_lib.cli import client_config as cloud_config
from osc_lib.command import timing
from osc_lib import exceptions as exc
from osc_lib import logs
@ -38,8 +39,6 @@ from openstackclient.common import clientmanager
from openstackclient.common import commandmanager
from openstackclient.i18n import _
from os_client_config import config as cloud_config
osprofiler_profiler = importutils.try_import("osprofiler.profiler")
@ -309,6 +308,9 @@ class OpenStackShell(app.App):
tenant_id = getattr(self.options, 'tenant_id', None)
tenant_name = getattr(self.options, 'tenant_name', None)
# Save default domain
self.default_domain = self.options.default_domain
# handle some v2/v3 authentication inconsistencies by just acting like
# both the project and tenant information are both present. This can
# go away if we stop registering all the argparse options together.
@ -325,7 +327,7 @@ class OpenStackShell(app.App):
# Ignore the default value of interface. Only if it is set later
# will it be used.
try:
cc = cloud_config.OpenStackConfig(
cc = cloud_config.OSC_Config(
override_defaults={
'interface': None,
'auth_type': auth_type,
@ -368,9 +370,6 @@ class OpenStackShell(app.App):
if self.verify and self.cloud.cacert:
self.verify = self.cloud.cacert
# Save default domain
self.default_domain = self.options.default_domain
# Loop through extensions to get API versions
for mod in clientmanager.PLUGIN_MODULES:
default_version = getattr(mod, 'DEFAULT_API_VERSION', None)
@ -429,7 +428,6 @@ class OpenStackShell(app.App):
self.client_manager = clientmanager.ClientManager(
cli_options=self.cloud,
verify=self.verify,
api_version=self.api_version,
pw_func=prompt_for_password,
)