Merge "Remove unused fields "from_*" from API controller"
This commit is contained in:
@@ -177,10 +177,6 @@ class BaysController(rest.RestController):
|
||||
def __init__(self):
|
||||
super(BaysController, self).__init__()
|
||||
|
||||
from_bays = False
|
||||
"""A flag to indicate if the requests to this controller are coming
|
||||
from the top-level resource Bays."""
|
||||
|
||||
_custom_actions = {
|
||||
'detail': ['GET'],
|
||||
}
|
||||
@@ -254,9 +250,6 @@ class BaysController(rest.RestController):
|
||||
|
||||
:param bay_ident: UUID of a bay or logical name of the bay.
|
||||
"""
|
||||
if self.from_bays:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_bay = api_utils.get_rpc_resource('Bay', bay_ident)
|
||||
|
||||
return Bay.convert_with_links(rpc_bay)
|
||||
@@ -268,9 +261,6 @@ class BaysController(rest.RestController):
|
||||
|
||||
:param bay: a bay within the request body.
|
||||
"""
|
||||
if self.from_bays:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
bay_dict = bay.as_dict()
|
||||
context = pecan.request.context
|
||||
auth_token = context.auth_token_info['token']
|
||||
@@ -295,9 +285,6 @@ class BaysController(rest.RestController):
|
||||
:param bay_ident: UUID or logical name of a bay.
|
||||
:param patch: a json PATCH document to apply to this bay.
|
||||
"""
|
||||
if self.from_bays:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_bay = api_utils.get_rpc_resource('Bay', bay_ident)
|
||||
try:
|
||||
bay_dict = rpc_bay.as_dict()
|
||||
@@ -327,9 +314,6 @@ class BaysController(rest.RestController):
|
||||
|
||||
:param bay_ident: UUID of a bay or logical name of the bay.
|
||||
"""
|
||||
if self.from_bays:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_bay = api_utils.get_rpc_resource('Bay', bay_ident)
|
||||
|
||||
pecan.request.rpcapi.bay_delete(rpc_bay.uuid)
|
||||
|
||||
@@ -179,10 +179,6 @@ class BayModelCollection(collection.Collection):
|
||||
class BayModelsController(rest.RestController):
|
||||
"""REST controller for BayModels."""
|
||||
|
||||
from_baymodels = False
|
||||
"""A flag to indicate if the requests to this controller are coming
|
||||
from the top-level resource BayModels."""
|
||||
|
||||
_custom_actions = {
|
||||
'detail': ['GET'],
|
||||
}
|
||||
@@ -270,9 +266,6 @@ class BayModelsController(rest.RestController):
|
||||
|
||||
:param baymodel_ident: UUID or logical name of a baymodel.
|
||||
"""
|
||||
if self.from_baymodels:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_baymodel = api_utils.get_rpc_resource('BayModel', baymodel_ident)
|
||||
return BayModel.convert_with_links(rpc_baymodel)
|
||||
|
||||
@@ -283,9 +276,6 @@ class BayModelsController(rest.RestController):
|
||||
|
||||
:param baymodel: a baymodel within the request body.
|
||||
"""
|
||||
if self.from_baymodels:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
baymodel_dict = baymodel.as_dict()
|
||||
context = pecan.request.context
|
||||
auth_token = context.auth_token_info['token']
|
||||
@@ -313,9 +303,6 @@ class BayModelsController(rest.RestController):
|
||||
:param baymodel_uuid: UUID of a baymodel.
|
||||
:param patch: a json PATCH document to apply to this baymodel.
|
||||
"""
|
||||
if self.from_baymodels:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_baymodel = objects.BayModel.get_by_uuid(pecan.request.context,
|
||||
baymodel_uuid)
|
||||
try:
|
||||
@@ -348,8 +335,5 @@ class BayModelsController(rest.RestController):
|
||||
|
||||
:param baymodel_uuid: UUID or logical name of a baymodel.
|
||||
"""
|
||||
if self.from_baymodels:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_baymodel = api_utils.get_rpc_resource('BayModel', baymodel_ident)
|
||||
rpc_baymodel.destroy()
|
||||
|
||||
@@ -262,10 +262,6 @@ class ContainersController(rest.RestController):
|
||||
logs = LogsController()
|
||||
execute = ExecuteController()
|
||||
|
||||
from_containers = False
|
||||
"""A flag to indicate if the requests to this controller are coming
|
||||
from the top-level resource Containers."""
|
||||
|
||||
_custom_actions = {
|
||||
'detail': ['GET'],
|
||||
}
|
||||
@@ -337,9 +333,6 @@ class ContainersController(rest.RestController):
|
||||
|
||||
:param container_ident: UUID or name of a container.
|
||||
"""
|
||||
if self.from_containers:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_container = api_utils.get_rpc_resource('Container',
|
||||
container_ident)
|
||||
res_container = pecan.request.rpcapi.container_show(rpc_container.uuid)
|
||||
@@ -351,9 +344,6 @@ class ContainersController(rest.RestController):
|
||||
|
||||
:param container: a container within the request body.
|
||||
"""
|
||||
if self.from_containers:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
container_dict = container.as_dict()
|
||||
context = pecan.request.context
|
||||
auth_token = context.auth_token_info['token']
|
||||
@@ -379,9 +369,6 @@ class ContainersController(rest.RestController):
|
||||
:param container_ident: UUID or name of a container.
|
||||
:param patch: a json PATCH document to apply to this container.
|
||||
"""
|
||||
if self.from_containers:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_container = api_utils.get_rpc_resource('Container',
|
||||
container_ident)
|
||||
try:
|
||||
@@ -412,9 +399,6 @@ class ContainersController(rest.RestController):
|
||||
|
||||
:param container_uuid: UUID of a container.
|
||||
"""
|
||||
if self.from_containers:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_container = api_utils.get_rpc_resource('Container',
|
||||
container_ident)
|
||||
pecan.request.rpcapi.container_delete(rpc_container.uuid)
|
||||
|
||||
@@ -122,10 +122,6 @@ class NodeCollection(collection.Collection):
|
||||
class NodesController(rest.RestController):
|
||||
"""REST controller for Nodes."""
|
||||
|
||||
from_nodes = False
|
||||
"""A flag to indicate if the requests to this controller are coming
|
||||
from the top-level resource Nodes."""
|
||||
|
||||
_custom_actions = {
|
||||
'detail': ['GET'],
|
||||
}
|
||||
@@ -198,9 +194,6 @@ class NodesController(rest.RestController):
|
||||
|
||||
:param node_uuid: UUID of a node.
|
||||
"""
|
||||
if self.from_nodes:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_node = objects.Node.get_by_uuid(pecan.request.context, node_uuid)
|
||||
return Node.convert_with_links(rpc_node)
|
||||
|
||||
@@ -211,9 +204,6 @@ class NodesController(rest.RestController):
|
||||
|
||||
:param node: a node within the request body.
|
||||
"""
|
||||
if self.from_nodes:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
node_dict = node.as_dict()
|
||||
context = pecan.request.context
|
||||
auth_token = context.auth_token_info['token']
|
||||
@@ -234,9 +224,6 @@ class NodesController(rest.RestController):
|
||||
:param node_uuid: UUID of a node.
|
||||
:param patch: a json PATCH document to apply to this node.
|
||||
"""
|
||||
if self.from_nodes:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_node = objects.Node.get_by_uuid(pecan.request.context, node_uuid)
|
||||
try:
|
||||
node_dict = rpc_node.as_dict()
|
||||
@@ -266,9 +253,6 @@ class NodesController(rest.RestController):
|
||||
|
||||
:param node_uuid: UUID of a node.
|
||||
"""
|
||||
if self.from_nodes:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_node = objects.Node.get_by_uuid(pecan.request.context,
|
||||
node_uuid)
|
||||
rpc_node.destroy()
|
||||
|
||||
@@ -168,10 +168,6 @@ class PodsController(rest.RestController):
|
||||
def __init__(self):
|
||||
super(PodsController, self).__init__()
|
||||
|
||||
from_pods = False
|
||||
"""A flag to indicate if the requests to this controller are coming
|
||||
from the top-level resource Pods."""
|
||||
|
||||
_custom_actions = {
|
||||
'detail': ['GET'],
|
||||
}
|
||||
@@ -241,9 +237,6 @@ class PodsController(rest.RestController):
|
||||
|
||||
:param pod_ident: UUID of a pod or logical name of the pod.
|
||||
"""
|
||||
if self.from_pods:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_pod = api_utils.get_rpc_resource('Pod', pod_ident)
|
||||
|
||||
return Pod.convert_with_links(rpc_pod)
|
||||
@@ -254,9 +247,6 @@ class PodsController(rest.RestController):
|
||||
|
||||
:param pod: a pod within the request body.
|
||||
"""
|
||||
if self.from_pods:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
pod.parse_manifest()
|
||||
pod_dict = pod.as_dict()
|
||||
context = pecan.request.context
|
||||
@@ -277,9 +267,6 @@ class PodsController(rest.RestController):
|
||||
:param pod_ident: UUID or logical name of a pod.
|
||||
:param patch: a json PATCH document to apply to this pod.
|
||||
"""
|
||||
if self.from_pods:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_pod = api_utils.get_rpc_resource('Pod', pod_ident)
|
||||
# Init manifest and manifest_url field because we don't store them
|
||||
# in database.
|
||||
@@ -317,9 +304,6 @@ class PodsController(rest.RestController):
|
||||
|
||||
:param pod_ident: UUID of a pod or logical name of the pod.
|
||||
"""
|
||||
if self.from_pods:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_pod = api_utils.get_rpc_resource('Pod', pod_ident)
|
||||
|
||||
pecan.request.rpcapi.pod_delete(rpc_pod.uuid)
|
||||
|
||||
@@ -198,10 +198,6 @@ class ReplicationControllersController(rest.RestController):
|
||||
def __init__(self):
|
||||
super(ReplicationControllersController, self).__init__()
|
||||
|
||||
from_rcs = False
|
||||
"""A flag to indicate if the requests to this controller are coming
|
||||
from the top-level resource ReplicationControllers."""
|
||||
|
||||
_custom_actions = {
|
||||
'detail': ['GET'],
|
||||
}
|
||||
@@ -275,9 +271,6 @@ class ReplicationControllersController(rest.RestController):
|
||||
|
||||
:param rc_ident: UUID or logical name of a ReplicationController.
|
||||
"""
|
||||
if self.from_rcs:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_rc = api_utils.get_rpc_resource('ReplicationController', rc_ident)
|
||||
return ReplicationController.convert_with_links(rpc_rc)
|
||||
|
||||
@@ -288,9 +281,6 @@ class ReplicationControllersController(rest.RestController):
|
||||
|
||||
:param rc: a ReplicationController within the request body.
|
||||
"""
|
||||
if self.from_rcs:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rc.parse_manifest()
|
||||
rc_dict = rc.as_dict()
|
||||
context = pecan.request.context
|
||||
@@ -315,9 +305,6 @@ class ReplicationControllersController(rest.RestController):
|
||||
:param rc_ident: UUID or logical name of a ReplicationController.
|
||||
:param patch: a json PATCH document to apply to this rc.
|
||||
"""
|
||||
if self.from_rcs:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_rc = api_utils.get_rpc_resource('ReplicationController', rc_ident)
|
||||
# Init manifest and manifest_url field because we don't store them
|
||||
# in database.
|
||||
@@ -356,8 +343,5 @@ class ReplicationControllersController(rest.RestController):
|
||||
|
||||
:param rc_uuid: UUID of a ReplicationController.
|
||||
"""
|
||||
if self.from_rcs:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_rc = api_utils.get_rpc_resource('ReplicationController', rc_ident)
|
||||
pecan.request.rpcapi.rc_delete(rpc_rc.uuid)
|
||||
|
||||
@@ -176,10 +176,6 @@ class ServicesController(rest.RestController):
|
||||
def __init__(self):
|
||||
super(ServicesController, self).__init__()
|
||||
|
||||
from_services = False
|
||||
"""A flag to indicate if the requests to this controller are coming
|
||||
from the top-level resource Services."""
|
||||
|
||||
_custom_actions = {
|
||||
'detail': ['GET'],
|
||||
}
|
||||
@@ -252,9 +248,6 @@ class ServicesController(rest.RestController):
|
||||
|
||||
:param service_ident: UUID or logical name of the service.
|
||||
"""
|
||||
if self.from_services:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_service = api_utils.get_rpc_resource('Service', service_ident)
|
||||
|
||||
return Service.convert_with_links(rpc_service)
|
||||
@@ -265,9 +258,6 @@ class ServicesController(rest.RestController):
|
||||
|
||||
:param service: a service within the request body.
|
||||
"""
|
||||
if self.from_services:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
service.parse_manifest()
|
||||
service_dict = service.as_dict()
|
||||
context = pecan.request.context
|
||||
@@ -291,9 +281,6 @@ class ServicesController(rest.RestController):
|
||||
:param service_ident: UUID or logical name of a service.
|
||||
:param patch: a json PATCH document to apply to this service.
|
||||
"""
|
||||
if self.from_services:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_service = api_utils.get_rpc_resource('Service', service_ident)
|
||||
# Init manifest and manifest_url field because we don't store them
|
||||
# in database.
|
||||
@@ -331,9 +318,6 @@ class ServicesController(rest.RestController):
|
||||
|
||||
:param service_ident: UUID or logical name of a service.
|
||||
"""
|
||||
if self.from_services:
|
||||
raise exception.OperationNotPermitted
|
||||
|
||||
rpc_service = api_utils.get_rpc_resource('Service', service_ident)
|
||||
|
||||
pecan.request.rpcapi.service_delete(rpc_service.uuid)
|
||||
|
||||
@@ -334,10 +334,6 @@ class NotAcceptable(MagnumException):
|
||||
code = 406
|
||||
|
||||
|
||||
class OperationNotPermitted(NotAuthorized):
|
||||
message = _("Operation not permitted.")
|
||||
|
||||
|
||||
class InvalidMAC(Invalid):
|
||||
message = _("Expected a MAC address but received %(mac)s.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user