Merge "Remove optional imports from clients.py"

This commit is contained in:
Jenkins 2014-06-11 16:33:01 +00:00 committed by Gerrit Code Review
commit 3ac07c2316
1 changed files with 6 additions and 46 deletions

View File

@ -11,10 +11,16 @@
# License for the specific language governing permissions and limitations
# under the License.
from ceilometerclient import client as ceilometerclient
from cinderclient import client as cinderclient
from glanceclient import client as glanceclient
from heatclient import client as heatclient
from neutronclient.v2_0 import client as neutronclient
from novaclient import client as novaclient
from novaclient import shell as novashell
from oslo.config import cfg
from swiftclient import client as swiftclient
from troveclient import client as troveclient
from heat.common import heat_keystoneclient as hkc
from heat.openstack.common.gettextutils import _
@ -24,40 +30,6 @@ from heat.openstack.common import log as logging
LOG = logging.getLogger(__name__)
try:
from swiftclient import client as swiftclient
except ImportError:
swiftclient = None
LOG.info(_('swiftclient not available'))
try:
from neutronclient.v2_0 import client as neutronclient
except ImportError:
neutronclient = None
LOG.info(_('neutronclient not available'))
try:
from cinderclient import client as cinderclient
except ImportError:
cinderclient = None
LOG.info(_('cinderclient not available'))
try:
from troveclient import client as troveclient
except ImportError:
troveclient = None
LOG.info(_('troveclient not available'))
try:
from ceilometerclient import client as ceilometerclient
except ImportError:
ceilometerclient = None
LOG.info(_('ceilometerclient not available'))
try:
from glanceclient import client as glanceclient
except ImportError:
glanceclient = None
LOG.info(_('glanceclient not available'))
_default_backend = "heat.engine.clients.OpenStackClients"
cloud_opts = [
@ -132,8 +104,6 @@ class OpenStackClients(object):
return client
def swift(self):
if swiftclient is None:
return None
if self._swift:
return self._swift
@ -156,8 +126,6 @@ class OpenStackClients(object):
return self._swift
def glance(self):
if glanceclient is None:
return None
if self._glance:
return self._glance
@ -181,8 +149,6 @@ class OpenStackClients(object):
return self._glance
def neutron(self):
if neutronclient is None:
return None
if self._neutron:
return self._neutron
@ -208,8 +174,6 @@ class OpenStackClients(object):
return self._neutron
def cinder(self):
if cinderclient is None:
return None
if self._cinder:
return self._cinder
@ -235,8 +199,6 @@ class OpenStackClients(object):
return self._cinder
def trove(self, service_type="database"):
if troveclient is None:
return None
if self._trove:
return self._trove
@ -262,8 +224,6 @@ class OpenStackClients(object):
return self._trove
def ceilometer(self):
if ceilometerclient is None:
return None
if self._ceilometer:
return self._ceilometer