Leverage openstack.common.importutils import_class
This patch drops the import_class method from utils and instead leverages the one in openstack.common.importutils. Change-Id: I9f740b9941d477776597c4c4ab88a65a39fb4fb8 Closes-bug: 1365273
This commit is contained in:
		@@ -30,7 +30,6 @@ import requests
 | 
				
			|||||||
from cinderclient import exceptions
 | 
					from cinderclient import exceptions
 | 
				
			||||||
from cinderclient.openstack.common import importutils
 | 
					from cinderclient.openstack.common import importutils
 | 
				
			||||||
from cinderclient.openstack.common import strutils
 | 
					from cinderclient.openstack.common import strutils
 | 
				
			||||||
from cinderclient import utils
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
osprofiler_web = importutils.try_import("osprofiler.web")
 | 
					osprofiler_web = importutils.try_import("osprofiler.web")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -526,7 +525,7 @@ def get_client_class(version):
 | 
				
			|||||||
            (version, ', '.join(version_map)))
 | 
					            (version, ', '.join(version_map)))
 | 
				
			||||||
        raise exceptions.UnsupportedVersion(msg)
 | 
					        raise exceptions.UnsupportedVersion(msg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return utils.import_class(client_path)
 | 
					    return importutils.import_class(client_path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def Client(version, *args, **kwargs):
 | 
					def Client(version, *args, **kwargs):
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -249,13 +249,6 @@ def safe_issubclass(*args):
 | 
				
			|||||||
    return False
 | 
					    return False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def import_class(import_str):
 | 
					 | 
				
			||||||
    """Returns a class from a string including module and class."""
 | 
					 | 
				
			||||||
    mod_str, _sep, class_str = import_str.rpartition('.')
 | 
					 | 
				
			||||||
    __import__(mod_str)
 | 
					 | 
				
			||||||
    return getattr(sys.modules[mod_str], class_str)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def _load_entry_point(ep_name, name=None):
 | 
					def _load_entry_point(ep_name, name=None):
 | 
				
			||||||
    """Try to load the entry point ep_name that matches name."""
 | 
					    """Try to load the entry point ep_name that matches name."""
 | 
				
			||||||
    for ep in pkg_resources.iter_entry_points(ep_name, name=name):
 | 
					    for ep in pkg_resources.iter_entry_points(ep_name, name=name):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user