Fix raises to raise an instance of a class.

Change-Id: Ief3e094e19aa0df471f1b40bbebc166ba8ba47dc
This commit is contained in:
Vasyl Saienko
2016-05-30 16:32:10 +03:00
parent b8f227e62e
commit 7a62b4afd4
3 changed files with 11 additions and 11 deletions

View File

@@ -222,7 +222,7 @@ class ChassisController(rest.RestController):
# /detail should only work against collections # /detail should only work against collections
parent = pecan.request.path.split('/')[:-1][-1] parent = pecan.request.path.split('/')[:-1][-1]
if parent != "chassis": if parent != "chassis":
raise exception.HTTPNotFound raise exception.HTTPNotFound()
resource_url = '/'.join(['chassis', 'detail']) resource_url = '/'.join(['chassis', 'detail'])
return self._get_chassis_collection(marker, limit, sort_key, sort_dir, return self._get_chassis_collection(marker, limit, sort_key, sort_dir,

View File

@@ -1168,7 +1168,7 @@ class NodesController(rest.RestController):
# /detail should only work against collections # /detail should only work against collections
parent = pecan.request.path.split('/')[:-1][-1] parent = pecan.request.path.split('/')[:-1][-1]
if parent != "nodes": if parent != "nodes":
raise exception.HTTPNotFound raise exception.HTTPNotFound()
resource_url = '/'.join(['nodes', 'detail']) resource_url = '/'.join(['nodes', 'detail'])
return self._get_nodes_collection(chassis_uuid, instance_uuid, return self._get_nodes_collection(chassis_uuid, instance_uuid,
@@ -1209,7 +1209,7 @@ class NodesController(rest.RestController):
of the resource to be returned. of the resource to be returned.
""" """
if self.from_chassis: if self.from_chassis:
raise exception.OperationNotPermitted raise exception.OperationNotPermitted()
api_utils.check_allow_specify_fields(fields) api_utils.check_allow_specify_fields(fields)
@@ -1223,7 +1223,7 @@ class NodesController(rest.RestController):
:param node: a node within the request body. :param node: a node within the request body.
""" """
if self.from_chassis: if self.from_chassis:
raise exception.OperationNotPermitted raise exception.OperationNotPermitted()
# NOTE(deva): get_topic_for checks if node.driver is in the hash ring # NOTE(deva): get_topic_for checks if node.driver is in the hash ring
# and raises NoValidHost if it is not. # and raises NoValidHost if it is not.
@@ -1262,7 +1262,7 @@ class NodesController(rest.RestController):
:param patch: a json PATCH document to apply to this node. :param patch: a json PATCH document to apply to this node.
""" """
if self.from_chassis: if self.from_chassis:
raise exception.OperationNotPermitted raise exception.OperationNotPermitted()
rpc_node = api_utils.get_rpc_node(node_ident) rpc_node = api_utils.get_rpc_node(node_ident)
@@ -1333,7 +1333,7 @@ class NodesController(rest.RestController):
:param node_ident: UUID or logical name of a node. :param node_ident: UUID or logical name of a node.
""" """
if self.from_chassis: if self.from_chassis:
raise exception.OperationNotPermitted raise exception.OperationNotPermitted()
rpc_node = api_utils.get_rpc_node(node_ident) rpc_node = api_utils.get_rpc_node(node_ident)

View File

@@ -317,7 +317,7 @@ class PortsController(rest.RestController):
# NOTE(lucasagomes): /detail should only work against collections # NOTE(lucasagomes): /detail should only work against collections
parent = pecan.request.path.split('/')[:-1][-1] parent = pecan.request.path.split('/')[:-1][-1]
if parent != "ports": if parent != "ports":
raise exception.HTTPNotFound raise exception.HTTPNotFound()
resource_url = '/'.join(['ports', 'detail']) resource_url = '/'.join(['ports', 'detail'])
return self._get_ports_collection(node_uuid or node, address, marker, return self._get_ports_collection(node_uuid or node, address, marker,
@@ -333,7 +333,7 @@ class PortsController(rest.RestController):
of the resource to be returned. of the resource to be returned.
""" """
if self.from_nodes: if self.from_nodes:
raise exception.OperationNotPermitted raise exception.OperationNotPermitted()
api_utils.check_allow_specify_fields(fields) api_utils.check_allow_specify_fields(fields)
@@ -347,7 +347,7 @@ class PortsController(rest.RestController):
:param port: a port within the request body. :param port: a port within the request body.
""" """
if self.from_nodes: if self.from_nodes:
raise exception.OperationNotPermitted raise exception.OperationNotPermitted()
new_port = objects.Port(pecan.request.context, new_port = objects.Port(pecan.request.context,
**port.as_dict()) **port.as_dict())
@@ -365,7 +365,7 @@ class PortsController(rest.RestController):
:param patch: a json PATCH document to apply to this port. :param patch: a json PATCH document to apply to this port.
""" """
if self.from_nodes: if self.from_nodes:
raise exception.OperationNotPermitted raise exception.OperationNotPermitted()
rpc_port = objects.Port.get_by_uuid(pecan.request.context, port_uuid) rpc_port = objects.Port.get_by_uuid(pecan.request.context, port_uuid)
try: try:
@@ -407,7 +407,7 @@ class PortsController(rest.RestController):
:param port_uuid: UUID of a port. :param port_uuid: UUID of a port.
""" """
if self.from_nodes: if self.from_nodes:
raise exception.OperationNotPermitted raise exception.OperationNotPermitted()
rpc_port = objects.Port.get_by_uuid(pecan.request.context, rpc_port = objects.Port.get_by_uuid(pecan.request.context,
port_uuid) port_uuid)
rpc_node = objects.Node.get_by_id(pecan.request.context, rpc_node = objects.Node.get_by_id(pecan.request.context,