diff options
-rw-r--r-- | cinderclient/client.py | 13 | ||||
-rw-r--r-- | doc/source/index.rst | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/cinderclient/client.py b/cinderclient/client.py index eb8c0de..ffc491f 100644 --- a/cinderclient/client.py +++ b/cinderclient/client.py @@ -18,7 +18,7 @@ import glob import hashlib -import imp +import importlib.util import itertools import logging import os @@ -799,6 +799,15 @@ def _discover_via_python_path(): yield name, module +def load_module(name, path): + module_spec = importlib.util.spec_from_file_location( + name, path + ) + module = importlib.util.module_from_spec(module_spec) + module_spec.loader.exec_module(module) + return module + + def _discover_via_contrib_path(version): module_path = os.path.dirname(os.path.abspath(__file__)) version_str = "v%s" % version.replace('.', '_') @@ -811,7 +820,7 @@ def _discover_via_contrib_path(version): if name == "__init__": continue - module = imp.load_source(name, ext_path) + module = load_module(name, ext_path) yield name, module diff --git a/doc/source/index.rst b/doc/source/index.rst index 2bd01af..eeb706c 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -14,7 +14,7 @@ can use the API like so:: ce06d0a8-5c1b-4e2c-81d2-39eca6bbfb70 >>> cinder.volumes.list() [<Volume: ce06d0a8-5c1b-4e2c-81d2-39eca6bbfb70>] - >>>myvol.delete + >>> myvol.delete() Alternatively, you can create a client instance using the keystoneauth session API:: |