summaryrefslogtreecommitdiff
path: root/openstackclient/compute/client.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-04-19 03:23:12 +0000
committerGerrit Code Review <review@openstack.org>2015-04-19 03:23:12 +0000
commita5e79d58ae508e218a113bfa3976fae369980688 (patch)
tree34bd042a6a7ffa305c165f6284c657606f3eee25 /openstackclient/compute/client.py
parent98604abcda52adffcfda866dc472b23714bfac70 (diff)
parentf43c1f76559ae8b5b738b7ae8b69b15c379f9145 (diff)
downloadpython-openstackclient-a5e79d58ae508e218a113bfa3976fae369980688.tar.gz
Merge "Defer client imports"
Diffstat (limited to 'openstackclient/compute/client.py')
-rw-r--r--openstackclient/compute/client.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/openstackclient/compute/client.py b/openstackclient/compute/client.py
index bdba4dca..93a7b715 100644
--- a/openstackclient/compute/client.py
+++ b/openstackclient/compute/client.py
@@ -15,14 +15,6 @@
import logging
-from novaclient import client as nova_client
-from novaclient import extension
-
-try:
- from novaclient.v2.contrib import list_extensions
-except ImportError:
- from novaclient.v1_1.contrib import list_extensions
-
from openstackclient.common import utils
LOG = logging.getLogger(__name__)
@@ -37,6 +29,15 @@ API_VERSIONS = {
def make_client(instance):
"""Returns a compute service client."""
+
+ # Defer client imports until we actually need them
+ from novaclient import client as nova_client
+ from novaclient import extension
+ try:
+ from novaclient.v2.contrib import list_extensions
+ except ImportError:
+ from novaclient.v1_1.contrib import list_extensions
+
compute_client = nova_client.get_client_class(
instance._api_version[API_NAME],
)