Add decorator expected_errors for v3 attach_interfaces
All v3 api should use expected_errors to prevent unexpected exception raised. This patch add decorator expected_errors for v3 attach_interfaces. This patch also remove update action. Let the wsgi return HTTPNotFound for it. Change-Id: Icefe9f9adfa7ad01bc3ab11dcb7c132702390d04
This commit is contained in:
parent
27fbfac5d5
commit
1bde349107
|
@ -54,11 +54,13 @@ class InterfaceAttachmentController(object):
|
|||
self.network_api = network.API()
|
||||
super(InterfaceAttachmentController, self).__init__()
|
||||
|
||||
@extensions.expected_errors((404, 501))
|
||||
def index(self, req, server_id):
|
||||
"""Returns the list of interface attachments for a given instance."""
|
||||
return self._items(req, server_id,
|
||||
entity_maker=_translate_interface_attachment_view)
|
||||
|
||||
@extensions.expected_errors(404)
|
||||
def show(self, req, server_id, id):
|
||||
"""Return data about the given interface attachment."""
|
||||
context = req.environ['nova.context']
|
||||
|
@ -78,6 +80,7 @@ class InterfaceAttachmentController(object):
|
|||
return {'interface_attachment': _translate_interface_attachment_view(
|
||||
port_info['port'])}
|
||||
|
||||
@extensions.expected_errors((400, 404, 409, 500, 501))
|
||||
@validation.schema(attach_interfaces.create)
|
||||
def create(self, req, server_id, body):
|
||||
"""Attach an interface to an instance."""
|
||||
|
@ -126,11 +129,7 @@ class InterfaceAttachmentController(object):
|
|||
|
||||
return self.show(req, server_id, vif['id'])
|
||||
|
||||
def update(self, req, server_id, id, body):
|
||||
"""Update a interface attachment. We don't currently support this."""
|
||||
msg = _("Attachments update is not supported")
|
||||
raise exc.HTTPNotImplemented(explanation=msg)
|
||||
|
||||
@extensions.expected_errors((404, 409, 501))
|
||||
def delete(self, req, server_id, id):
|
||||
"""Detach an interface from an instance."""
|
||||
context = req.environ['nova.context']
|
||||
|
|
Loading…
Reference in New Issue