From 67f6d1c6d8535c95b9928fa1f0ef50e73c912ce9 Mon Sep 17 00:00:00 2001 From: Feng Shengqin Date: Tue, 20 Dec 2016 18:45:26 +0800 Subject: [PATCH] Remove unused method in api utils Closes-Bug: #1651247 Change-Id: I4d3bb558afdcc2283864cd177279779a24e40aa4 --- zun/api/utils.py | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/zun/api/utils.py b/zun/api/utils.py index 3d10b02d1..ba7bae28a 100644 --- a/zun/api/utils.py +++ b/zun/api/utils.py @@ -18,7 +18,6 @@ from oslo_utils import uuidutils import pecan import wsme -from zun.common import exception from zun.common.i18n import _ import zun.conf from zun import objects @@ -86,34 +85,6 @@ def get_resource(resource, resource_ident): return resource.get_by_name(pecan.request.context, resource_ident) -def get_openstack_resource(manager, resource_ident, resource_type): - """Get the openstack resource from the uuid or logical name. - - :param manager: the resource manager class. - :param resource_ident: the UUID or logical name of the resource. - :param resource_type: the type of the resource - - :returns: The openstack resource. - :raises: ResourceNotFound if the openstack resource is not exist. - Conflict if multi openstack resources have same name. - """ - if uuidutils.is_uuid_like(resource_ident): - resource_data = manager.get(resource_ident) - else: - filters = {'name': resource_ident} - matches = list(manager.list(filters=filters)) - if len(matches) == 0: - raise exception.ResourceNotFound(name=resource_type, - id=resource_ident) - if len(matches) > 1: - msg = ("Multiple '%s' exist with same name '%s'. " - "Please use the resource id instead." % - (resource_type, resource_ident)) - raise exception.Conflict(msg) - resource_data = matches[0] - return resource_data - - def _do_enforce_content_types(pecan_req, valid_content_types): """Content type enforcement