summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Taylor <louis@kragniz.eu>2015-07-03 02:44:42 +0000
committerLouis Taylor <louis@kragniz.eu>2015-07-03 03:00:34 +0000
commitb3f347264968f2437504b0e840a76977c31c488a (patch)
tree38d2b1583a0f23f10186f731e2142c37e7d8d0bf
parent0aa566eabd6866e9d3d7b43e06e921e326a7b137 (diff)
downloadglance_store-b3f347264968f2437504b0e840a76977c31c488a.tar.gz
Make cinderclient a more optional dependency
This catches import errors around cinderclient imports in the cinder store. Since python-cinderclient was moved to test-requirements.txt, it is not installed in the main glance gate jobs. This caused a lot of errors in the logs, which should be avoided. Change-Id: Iec6ac7020f66f9f9728d6cf4452127b8d55a8b2d Closes-Bug: #1471063
-rw-r--r--glance_store/_drivers/cinder.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/glance_store/_drivers/cinder.py b/glance_store/_drivers/cinder.py
index ab9e284..66829ea 100644
--- a/glance_store/_drivers/cinder.py
+++ b/glance_store/_drivers/cinder.py
@@ -14,9 +14,6 @@
import logging
-from cinderclient import exceptions as cinder_exception
-from cinderclient import service_catalog
-from cinderclient.v2 import client as cinderclient
from oslo_config import cfg
from oslo_utils import units
@@ -27,6 +24,15 @@ from glance_store import exceptions
from glance_store.i18n import _
import glance_store.location
+try:
+ from cinderclient import exceptions as cinder_exception
+ from cinderclient import service_catalog
+ from cinderclient.v2 import client as cinderclient
+except ImportError:
+ cinder_exception = None
+ service_catalog = None
+ cinderclient = None
+
LOG = logging.getLogger(__name__)
_CINDER_OPTS = [