Files
neutron/neutron/pecan_wsgi/hooks/__init__.py
Salvatore Orlando 12646fa68f Pecan: get rid of member action hook
The MemberAction hook, which parses the URL to find out if there is
anything beyond the resource identifier which might be interpreted as
an action to execute is an abomination and a horrible hack.
This patch does some justice by casting it into the abyss of git
history, hopefully forever.

As a matter of fact, the only Neutron API resource that uses this
capability is the router, with the actions 'add_router_interface' and
'remove_reouter_interface'. Therefore, not without a good deal of
deliberate opinionated thinking, this patch adds a specialiized Pecan
controller for the router resource rather than adding the abiity to
handle member actions in the generic resource controller.
The main driver behind this decision is that "member actions" should
be avoided as much as possile, and there is not yet an agreed-upon API
guideline on how they should be expressed in OpenStack APIs.

The 'router' extension (neutron/extensions/l3.py) has also been
"pecanized", by returning a RouterController for routers and an
instance of the generic ItemController for floating IPs.

Moreover, references to the 'member_action' parameter in the request
context are removed. The BodyValidation hook has been updated to
process the request body only if a resource or collection name can be
found in it (member actions don't have any according to the Neutron
API specification).

Finally, this patch adds functional tests specific for validating
member action processing in the router controller.

Related-Blueprint: wsgi-pecan-switch

Change-Id: Ib57472b38f5b1576387c8bf49c082ce25d3e5bd6
2016-02-19 04:30:08 -08:00

32 lines
1.3 KiB
Python

# Copyright (c) 2015 Mirantis, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from neutron.pecan_wsgi.hooks import body_validation
from neutron.pecan_wsgi.hooks import context
from neutron.pecan_wsgi.hooks import notifier
from neutron.pecan_wsgi.hooks import ownership_validation
from neutron.pecan_wsgi.hooks import policy_enforcement
from neutron.pecan_wsgi.hooks import quota_enforcement
from neutron.pecan_wsgi.hooks import translation
ExceptionTranslationHook = translation.ExceptionTranslationHook
ContextHook = context.ContextHook
BodyValidationHook = body_validation.BodyValidationHook
OwnershipValidationHook = ownership_validation.OwnershipValidationHook
PolicyHook = policy_enforcement.PolicyHook
QuotaEnforcementHook = quota_enforcement.QuotaEnforcementHook
NotifierHook = notifier.NotifierHook