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
This commit is contained in:
Hongbin Lu 2016-06-08 16:27:46 -05:00
parent 5e8bf40d5a
commit 596b551520

View File

@ -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