コード例 #1
0
ファイル: service.py プロジェクト: raman-mystack/tesora-trove
 def delete(self, req, tenant_id, instance_id, id):
     LOG.info(_("Deleting schema for instance '%s'") % instance_id)
     LOG.info(_("req : '%s'\n\n") % req)
     context = req.environ[wsgi.CONTEXT_KEY]
     context.notification = notification.DBaaSDatabaseDelete(context,
                                                             request=req)
     with StartNotification(context, instance_id=instance_id, dbname=id):
         try:
             schema = guest_models.ValidatedMySQLDatabase()
             schema.name = id
             models.Schema.delete(context, instance_id, schema.serialize())
         except (ValueError, AttributeError) as e:
             raise exception.BadRequest(msg=str(e))
     return wsgi.Result(None, 202)
コード例 #2
0
ファイル: service.py プロジェクト: wffeige/trove
 def delete(self, req, tenant_id, instance_id, id):
     LOG.info("Deleting schema for instance '%(id)s'\n"
              "req : '%(req)s'\n\n",
              {"id": instance_id, "req": req})
     context = req.environ[wsgi.CONTEXT_KEY]
     self.authorize_target_action(
         context, 'database:delete', instance_id)
     context.notification = notification.DBaaSDatabaseDelete(
         context, request=req)
     with StartNotification(context, instance_id=instance_id, dbname=id):
         try:
             schema = guest_models.MySQLSchema(name=id)
             schema.check_delete()
             if not models.Schemas.find(context, instance_id, id):
                 raise exception.DatabaseNotFound(uuid=id)
             models.Schema.delete(context, instance_id, schema.serialize())
         except (ValueError, AttributeError) as e:
             raise exception.BadRequest(_("Database delete error: %(e)s")
                                        % {'e': e})
     return wsgi.Result(None, 202)