From: armando-migliaccio Date: Thu, 2 Jul 2015 02:46:16 +0000 (-0700) Subject: Fall back on empty path if prefix is missing X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=9aaa2befdece5036fb8a6c3bdee6290d3658745d;p=openstack-build%2Fneutron-build.git Fall back on empty path if prefix is missing A missing entry causes a KeyError that leads the server to blow up during startup. We can fallback on an empty path (like some services do), in case the prefix is not specified. Furthermore, we can be declarative with this property, the same way we are with properties like aliases, bulk support, etc. Change-Id: I58a9b90a39d434f4808264aeb6f9ee5aceff7fbd --- diff --git a/neutron/api/v2/resource_helper.py b/neutron/api/v2/resource_helper.py index 9d952901b..61090638b 100644 --- a/neutron/api/v2/resource_helper.py +++ b/neutron/api/v2/resource_helper.py @@ -82,10 +82,12 @@ 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, - path_prefix=constants.COMMON_PREFIXES[which_service], + path_prefix=path_prefix, member_actions=member_actions, attr_map=params) resources.append(resource)