diff --git a/ironic/api/controllers/v1/node.py b/ironic/api/controllers/v1/node.py index 0be3bb6240..303bbd3ca0 100644 --- a/ironic/api/controllers/v1/node.py +++ b/ironic/api/controllers/v1/node.py @@ -388,7 +388,7 @@ class NodeStatesController(rest.RestController): # Change error code as 404 seems appropriate because RAID is a # standard interface and all drivers might not have it. e.code = http_client.NOT_FOUND - raise e + raise @expose.expose(None, types.uuid_or_name, wtypes.text, status_code=http_client.ACCEPTED) @@ -599,7 +599,7 @@ class Node(base.APIBase): # Change error code because 404 (NotFound) is inappropriate # response for a POST request to create a Port e.code = http_client.BAD_REQUEST - raise e + raise elif value == wtypes.Unset: self._chassis_uuid = wtypes.Unset @@ -907,7 +907,7 @@ class NodeMaintenanceController(rest.RestController): topic = pecan.request.rpcapi.get_topic_for(rpc_node) except exception.NoValidHost as e: e.code = http_client.BAD_REQUEST - raise e + raise pecan.request.rpcapi.update_node(pecan.request.context, rpc_node, topic=topic) @@ -1240,7 +1240,7 @@ class NodesController(rest.RestController): # list of available drivers and shouldn't request # one that doesn't exist. e.code = http_client.BAD_REQUEST - raise e + raise if node.name != wtypes.Unset and node.name is not None: error_msg = _("Cannot create node with invalid name '%(name)s'") @@ -1309,7 +1309,7 @@ class NodesController(rest.RestController): # list of available drivers and shouldn't request # one that doesn't exist. e.code = http_client.BAD_REQUEST - raise e + raise self._check_driver_changed_and_console_enabled(rpc_node, node_ident) new_node = pecan.request.rpcapi.update_node( pecan.request.context, rpc_node, topic) @@ -1332,7 +1332,7 @@ class NodesController(rest.RestController): topic = pecan.request.rpcapi.get_topic_for(rpc_node) except exception.NoValidHost as e: e.code = http_client.BAD_REQUEST - raise e + raise pecan.request.rpcapi.destroy_node(pecan.request.context, rpc_node.uuid, topic) diff --git a/ironic/api/controllers/v1/port.py b/ironic/api/controllers/v1/port.py index ab0166b778..b5f332c2c9 100644 --- a/ironic/api/controllers/v1/port.py +++ b/ironic/api/controllers/v1/port.py @@ -70,7 +70,7 @@ class Port(base.APIBase): # Change error code because 404 (NotFound) is inappropriate # response for a POST request to create a Port e.code = http_client.BAD_REQUEST # BadRequest - raise e + raise elif value == wtypes.Unset: self._node_uuid = wtypes.Unset diff --git a/ironic/db/sqlalchemy/api.py b/ironic/db/sqlalchemy/api.py index 8f8d9aa6c1..79b7aa8f2f 100644 --- a/ironic/db/sqlalchemy/api.py +++ b/ironic/db/sqlalchemy/api.py @@ -405,7 +405,7 @@ class Connection(api.Connection): instance_uuid=values['instance_uuid'], node=node_id) else: - raise e + raise def _do_update_node(self, node_id, values): with _session_for_write(): @@ -600,7 +600,7 @@ class Connection(api.Connection): raise exception.PortgroupMACAlreadyExists( mac=values['address']) else: - raise exc + raise return ref def destroy_portgroup(self, portgroup_id):