コード例 #1
0
    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)
コード例 #2
0
    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)
コード例 #3
0
ファイル: security_service.py プロジェクト: yongwc09/manila
    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)
コード例 #4
0
ファイル: security_service.py プロジェクト: hunchback/manila
    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)