Make method import_versioned_module work

Update function import_versioned_module in Oslo.utils 3.17
This patch update to meet new version. For more information:
http://docs.openstack.org/developer/oslo.utils/history.html

Change-Id: I9c3ba7acc9b04e766ae4e55f817a5c876a0e8752
Closes-Bug: #1627313
This commit is contained in:
Luong Anh Tuan 2016-11-02 16:24:56 +07:00 committed by Tuan Luong-Anh
parent 748b18d6b3
commit 664905565f
2 changed files with 3 additions and 10 deletions

View File

@ -13,12 +13,13 @@
import exc import exc
from keystoneauth1 import adapter as keystoneauth from keystoneauth1 import adapter as keystoneauth
from vitrageclient.common import utils from oslo_utils import importutils
# noinspection PyPep8Naming # noinspection PyPep8Naming
def Client(version, *args, **kwargs): def Client(version, *args, **kwargs):
module = utils.import_versioned_module(version, 'client') module = importutils.import_versioned_module('vitrageclient',
version, 'client')
client_class = getattr(module, 'Client') client_class = getattr(module, 'Client')
return client_class(*args, **kwargs) return client_class(*args, **kwargs)

View File

@ -11,14 +11,6 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo_utils import importutils
def import_versioned_module(version, submodule=None):
module = 'vitrageclient.v%s' % version
if submodule:
module = '.'.join((module, submodule))
return importutils.import_module(module)
def args_to_dict(args, attrs): def args_to_dict(args, attrs):