From: armando-migliaccio Date: Thu, 2 Jul 2015 19:56:24 +0000 (-0700) Subject: COMMON_PREFIXES cleanup - patch 5/5 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=18bc67d5;p=openstack-build%2Fneutron-build.git COMMON_PREFIXES cleanup - patch 5/5 Get rid of COMMON_PREFIXES, as now the prefix is a service's declaritive property. Change-Id: I3d306131df94188f75e69edb13d262721d10bee5 Depends-on: I0450d0b2bf409d470a3a87bfd96518939759a84e Depends-on: Ia34695967cbbec0a1cf0884dad82e096de8539b8 Depends-on: Ib9517b772fe426eaf0809c439aa3ba0448c7abaa --- diff --git a/neutron/api/v2/resource_helper.py b/neutron/api/v2/resource_helper.py index 61090638b..05e403d03 100644 --- a/neutron/api/v2/resource_helper.py +++ b/neutron/api/v2/resource_helper.py @@ -14,6 +14,7 @@ # under the License. from oslo_config import cfg +from oslo_log import log as logging from neutron.api import extensions from neutron.api.v2 import base @@ -21,6 +22,8 @@ from neutron import manager from neutron.plugins.common import constants from neutron import quota +LOG = logging.getLogger(__name__) + def build_plural_mappings(special_mappings, resource_map): """Create plural to singular mapping for all resources. @@ -68,6 +71,9 @@ def build_resource_info(plural_mappings, resource_map, which_service, plugin = manager.NeutronManager.get_service_plugins()[which_service] else: plugin = manager.NeutronManager.get_plugin() + path_prefix = getattr(plugin, "path_prefix", "") + LOG.debug('Service %(service)s assigned prefix: %(prefix)s' + % {'service': which_service, 'prefix': path_prefix}) for collection_name in resource_map: resource_name = plural_mappings[collection_name] params = resource_map.get(collection_name, {}) @@ -82,8 +88,6 @@ def build_resource_info(plural_mappings, resource_map, which_service, allow_bulk=allow_bulk, allow_pagination=cfg.CONF.allow_pagination, allow_sorting=cfg.CONF.allow_sorting) - path_prefix = getattr(plugin, "path_prefix", - constants.COMMON_PREFIXES.get(which_service, "")) resource = extensions.ResourceExtension( collection_name, controller, diff --git a/neutron/plugins/common/constants.py b/neutron/plugins/common/constants.py index 401b01dd0..63947ae6f 100644 --- a/neutron/plugins/common/constants.py +++ b/neutron/plugins/common/constants.py @@ -34,13 +34,6 @@ EXT_TO_SERVICE_MAPPING = { 'router': L3_ROUTER_NAT } -COMMON_PREFIXES = { - LOADBALANCER: "/lb", - LOADBALANCERV2: "/lbaas", - FIREWALL: "/fw", - VPN: "/vpn", -} - # Service operation status constants ACTIVE = "ACTIVE" DOWN = "DOWN"