def get_client_class(version): version_map = {"1": "cinderclient.v1.client.Client", "2": "cinderclient.v2.client.Client"} try: client_path = version_map[str(version)] except (KeyError, ValueError): msg = "Invalid client version '%s'. must be one of: %s" % ((version, ", ".join(version_map))) raise exceptions.UnsupportedVersion(msg) return utils.import_class(client_path)
def get_client_class(version): version_map = { '1': 'cinderclient.v1.client.Client', } try: client_path = version_map[str(version)] except (KeyError, ValueError): msg = "Invalid client version '%s'. must be one of: %s" % ( (version, ', '.join(version_map.keys()))) raise exceptions.UnsupportedVersion(msg) return utils.import_class(client_path)