summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2016-01-08 20:38:35 -0500
committerMonty Taylor <mordred@inaugust.com>2016-01-08 20:38:35 -0500
commitf61a487fa13c8292b9fd3ac103e1133ac05dbd26 (patch)
tree161097a97bec554548a59b48378af96aadb167ec
parent9835daf9f684556c5aed4834dc086e932788f9bc (diff)
downloados-client-config-f61a487fa13c8292b9fd3ac103e1133ac05dbd26.tar.gz
Use _get_client in make_client helper function
We have a capability to know what constructor is needed for make_client, but we didn't plumb it in. Make sure that the only thing needed is: os_client_config.make_client('compute') Change-Id: I02aa1c46fa7cdfdb1409f8e1232e364b5ba48cd2
-rw-r--r--os_client_config/__init__.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/os_client_config/__init__.py b/os_client_config/__init__.py
index ece1559..52fcb85 100644
--- a/os_client_config/__init__.py
+++ b/os_client_config/__init__.py
@@ -14,6 +14,7 @@
import sys
+from os_client_config import cloud_config
from os_client_config.config import OpenStackConfig # noqa
@@ -34,7 +35,7 @@ def simple_client(service_key, cloud=None, region_name=None):
cloud=cloud, region_name=region_name).get_session_client(service_key)
-def make_client(service_key, constructor, options=None, **kwargs):
+def make_client(service_key, constructor=None, options=None, **kwargs):
"""Simple wrapper for getting a client instance from a client lib.
OpenStack Client Libraries all have a fairly consistent constructor
@@ -44,6 +45,8 @@ def make_client(service_key, constructor, options=None, **kwargs):
variables and clouds.yaml - and takes as **kwargs anything you'd expect
to pass in.
"""
+ if not constructor:
+ constructor = cloud_config._get_client(service_key)
config = OpenStackConfig()
if options:
config.register_argparse_options(options, sys.argv, service_key)
@@ -51,5 +54,5 @@ def make_client(service_key, constructor, options=None, **kwargs):
else:
parsed_options = None
- cloud_config = config.get_one_cloud(options=parsed_options, **kwargs)
- return cloud_config.get_legacy_client(service_key, constructor)
+ cloud = config.get_one_cloud(options=parsed_options, **kwargs)
+ return cloud.get_legacy_client(service_key, constructor)