Example #1
0
 def delete(self, req, tenant_id, id):
     context = req.environ[wsgi.CONTEXT_KEY]
     group = models.Configuration.load(context, id)
     instances = instances_models.DBInstance.find_all(
         tenant_id=context.tenant, configuration_id=id,
         deleted=False).all()
     if instances:
         raise exception.InstanceAssignedToConfiguration()
     models.Configuration.delete(context, group)
     return wsgi.Result(None, 202)
Example #2
0
    def delete(self, req, tenant_id, id):
        msg = _("Deleting configuration group %(cfg_id)s on tenant: "
                "%(tenant_id)s")
        LOG.info(msg % {"tenant_id": tenant_id, "cfg_id": id})

        context = req.environ[wsgi.CONTEXT_KEY]
        group = models.Configuration.load(context, id)
        instances = instances_models.DBInstance.find_all(
            tenant_id=context.tenant, configuration_id=id,
            deleted=False).all()
        if instances:
            raise exception.InstanceAssignedToConfiguration()
        models.Configuration.delete(context, group)
        return wsgi.Result(None, 202)
Example #3
0
    def delete(self, req, tenant_id, id):
        msg = ("Deleting configuration group %(cfg_id)s on tenant: "
               "%(tenant_id)s")
        LOG.info(msg, {"tenant_id": tenant_id, "cfg_id": id})

        context = req.environ[wsgi.CONTEXT_KEY]
        group = models.Configuration.load(context, id)
        self.authorize_config_action(context, 'delete', group)
        context.notification = notification.DBaaSConfigurationDelete(
            context, request=req)
        with StartNotification(context, configuration_id=id):
            instances = instances_models.DBInstance.find_all(
                tenant_id=context.tenant, configuration_id=id,
                deleted=False).all()
            if instances:
                raise exception.InstanceAssignedToConfiguration()
            models.Configuration.delete(context, group)
        return wsgi.Result(None, 202)