Remove dead versions code
The versions endpoint is now handled by Pecan and there is no way to reach this old endpoint now that we have dropped the web_framework option. Change-Id: I5d493623b107f125cb9426310f2e43612c94bb7f
This commit is contained in:
parent
a3dff9769b
commit
de82ded117
@ -36,7 +36,7 @@ paste.filter_factory = keystonemiddleware.auth_token:filter_factory
|
||||
paste.filter_factory = neutron.api.extensions:plugin_aware_extension_middleware_factory
|
||||
|
||||
[app:neutronversions]
|
||||
paste.app_factory = neutron.api.versions:Versions.factory
|
||||
paste.app_factory = neutron.pecan_wsgi.app:versions_factory
|
||||
|
||||
[app:neutronapiapp_v2_0]
|
||||
paste.app_factory = neutron.api.v2.router:APIRouter.factory
|
||||
|
@ -13,54 +13,15 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import oslo_i18n
|
||||
import webob.dec
|
||||
from debtcollector import removals
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.api.views import versions as versions_view
|
||||
from neutron.pecan_wsgi import app as pecan_app
|
||||
from neutron import wsgi
|
||||
|
||||
|
||||
class Versions(object):
|
||||
|
||||
@removals.remove(version="Queens", removal_version="Rocky",
|
||||
message="Use neutron.pecan_wsgi.app:versions_factory")
|
||||
@classmethod
|
||||
def factory(cls, global_config, **local_config):
|
||||
# TODO(kevinbenton): get rid of whole class
|
||||
return pecan_app.versions_factory(global_config, **local_config)
|
||||
|
||||
@webob.dec.wsgify(RequestClass=wsgi.Request)
|
||||
def __call__(self, req):
|
||||
"""Respond to a request for all Neutron API versions."""
|
||||
version_objs = [
|
||||
{
|
||||
"id": "v2.0",
|
||||
"status": "CURRENT",
|
||||
},
|
||||
]
|
||||
|
||||
if req.path != '/':
|
||||
if self.app:
|
||||
return req.get_response(self.app)
|
||||
language = req.best_match_language()
|
||||
msg = _('Unknown API version specified')
|
||||
msg = oslo_i18n.translate(msg, language)
|
||||
return webob.exc.HTTPNotFound(explanation=msg)
|
||||
|
||||
builder = versions_view.get_view_builder(req)
|
||||
versions = [builder.build(version) for version in version_objs]
|
||||
response = dict(versions=versions)
|
||||
metadata = {}
|
||||
|
||||
content_type = req.best_match_content_type()
|
||||
body = (wsgi.Serializer(metadata=metadata).
|
||||
serialize(response, content_type))
|
||||
|
||||
response = webob.Response()
|
||||
response.content_type = content_type
|
||||
response.body = wsgi.encode_body(body)
|
||||
|
||||
return response
|
||||
|
||||
def __init__(self, app):
|
||||
self.app = app
|
||||
|
@ -36,7 +36,7 @@ paste.filter_factory = keystonemiddleware.auth_token:filter_factory
|
||||
paste.filter_factory = neutron.api.extensions:plugin_aware_extension_middleware_factory
|
||||
|
||||
[app:neutronversions]
|
||||
paste.app_factory = neutron.api.versions:Versions.factory
|
||||
paste.app_factory = neutron.pecan_wsgi.app:versions_factory
|
||||
|
||||
[app:neutronapiapp_v2_0]
|
||||
paste.app_factory = neutron.api.v2.router:APIRouter.factory
|
||||
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
deprecations:
|
||||
- |
|
||||
The api-paste entrypoint ``neutron.api.versions:Versions.factory`` has been
|
||||
deprecated and will be removed in the Rocky release. Please update your
|
||||
api-paste.ini file to use the one that ships with Queens or update any
|
||||
references to the Versions factory to point to
|
||||
``neutron.pecan_wsgi.app:versions_factory`` instead.
|
Loading…
Reference in New Issue
Block a user