Merge "Add back client module"
This commit is contained in:
23
senlinclient/client.py
Normal file
23
senlinclient/client.py
Normal file
@@ -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 heatclient.common import template_utils
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
from oslo_utils import importutils
|
||||||
import prettytable
|
import prettytable
|
||||||
import six
|
import six
|
||||||
import yaml
|
import yaml
|
||||||
@@ -23,6 +24,13 @@ from senlinclient.common import exc
|
|||||||
from senlinclient.common.i18n import _
|
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):
|
def format_nested_dict(d, fields, column_names):
|
||||||
if d is None:
|
if d is None:
|
||||||
return ''
|
return ''
|
||||||
|
Reference in New Issue
Block a user