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
This commit is contained in:
armando-migliaccio 2015-07-02 12:56:24 -07:00 committed by Kyle Mestery
parent d845c6cdbd
commit 18bc67d56f
2 changed files with 6 additions and 9 deletions

View File

@ -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,

View File

@ -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"