def delete(self, req, id): """Delete a security service.""" context = req.environ['manila.context'] LOG.audit(_("Delete security service with id: %s"), id, context=context) try: security_service = db.security_service_get(context, id) policy.check_policy(context, RESOURCE_NAME, 'delete', security_service) db.security_service_delete(context, id) except exception.NotFound: raise exc.HTTPNotFound() except exception.InvalidShare: raise exc.HTTPForbidden() return webob.Response(status_int=202)
def delete(self, req, id): """Delete a security service.""" context = req.environ['manila.context'] LOG.info(_("Delete security service with id: %s"), id, context=context) try: security_service = db.security_service_get(context, id) except exception.NotFound: raise exc.HTTPNotFound() share_nets = db.share_network_get_all_by_security_service(context, id) if share_nets: # Cannot delete security service # if it is assigned to share networks raise exc.HTTPForbidden() policy.check_policy(context, RESOURCE_NAME, 'delete', security_service) db.security_service_delete(context, id) return webob.Response(status_int=202)
def delete(self, req, id): """Delete a security service.""" context = req.environ['manila.context'] LOG.info("Delete security service with id: %s", id, context=context) try: security_service = db.security_service_get(context, id) except exception.NotFound: raise exc.HTTPNotFound() share_nets = db.share_network_get_all_by_security_service(context, id) if share_nets: msg = _("Cannot delete security service. It is " "assigned to share network(s)") raise exc.HTTPForbidden(explanation=msg) policy.check_policy(context, RESOURCE_NAME, 'delete', security_service) db.security_service_delete(context, id) return webob.Response(status_int=http_client.ACCEPTED)
def delete(self, req, id): """Delete a security service.""" context = req.environ['manila.context'] LOG.info(_LI("Delete security service with id: %s"), id, context=context) try: security_service = db.security_service_get(context, id) except exception.NotFound: raise exc.HTTPNotFound() share_nets = db.share_network_get_all_by_security_service( context, id) if share_nets: # Cannot delete security service # if it is assigned to share networks raise exc.HTTPForbidden() policy.check_policy(context, RESOURCE_NAME, 'delete', security_service) db.security_service_delete(context, id) return webob.Response(status_int=202)