Add back client module
The removal of the Client module breaks downstream consumers such as heat. This patch adds it back. Change-Id: I422bd6e9ab0cbb985380f1b898435344f1dd8ac9
This commit is contained in:
parent
3784a4b4eb
commit
8dd4afab50
|
@ -0,0 +1,23 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from senlinclient.common import utils
|
||||
|
||||
|
||||
def Client(api_ver, *args, **kwargs):
|
||||
"""Import versioned client module.
|
||||
|
||||
:param api_ver: API version required.
|
||||
"""
|
||||
module = utils.import_versioned_module(api_ver, 'client')
|
||||
cls = getattr(module, 'Client')
|
||||
return cls(*args, **kwargs)
|
|
@ -15,6 +15,7 @@ from __future__ import print_function
|
|||
|
||||
from heatclient.common import template_utils
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import importutils
|
||||
import prettytable
|
||||
import six
|
||||
import yaml
|
||||
|
@ -23,6 +24,13 @@ from senlinclient.common import exc
|
|||
from senlinclient.common.i18n import _
|
||||
|
||||
|
||||
def import_versioned_module(version, submodule=None):
|
||||
module = 'senlinclient.v%s' % version
|
||||
if submodule:
|
||||
module = '.'.join((module, submodule))
|
||||
return importutils.import_module(module)
|
||||
|
||||
|
||||
def format_nested_dict(d, fields, column_names):
|
||||
if d is None:
|
||||
return ''
|
||||
|
|
Loading…
Reference in New Issue