From 596b551520b41c9f9b4cee58bb07dc08f4e13486 Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Wed, 8 Jun 2016 16:27:46 -0500 Subject: [PATCH] Magnum plugin: import exceptions robustly Magnum will remove all modules under magnumclient/openstack [1]. This plugin needs to update the import path. [1] https://review.openstack.org/#/c/327200/ Change-Id: I3ec10edbaa6ed92d8875f990ca3be6e339d81310 --- contrib/plugins/magnum_plugin/magnum_plugin/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/contrib/plugins/magnum_plugin/magnum_plugin/__init__.py b/contrib/plugins/magnum_plugin/magnum_plugin/__init__.py index 65a06842..7d1d5b85 100644 --- a/contrib/plugins/magnum_plugin/magnum_plugin/__init__.py +++ b/contrib/plugins/magnum_plugin/magnum_plugin/__init__.py @@ -15,12 +15,17 @@ import cfg import time -import magnumclient from magnumclient import client from murano.common import auth_utils from murano.dsl import session_local_storage from oslo_config import cfg as config +try: + from magnumclient.common.apiclient import exceptions +except ImportError: + # NOTE (hongbin): For magnumclient versions before 2.0.0. + from magnumclient.openstack.common.apiclient import exceptions + CONF = config.CONF @@ -85,5 +90,5 @@ class MagnumClient(object): self._wait_on_status(bays, bay_id, ["CREATE_COMPLETE", "DELETE_IN_PROGRESS", "CREATE_FAILED"], ["DELETE_COMPLETE"]) - except magnumclient.openstack.common.apiclient.exceptions.NotFound: + except exceptions.NotFound: pass