def create(self, req, body, tenant_id, instance_id): """Creates a set of schemas.""" LOG.info("Creating schema for instance '%(id)s'\n" "req : '%(req)s'\n\n" "body: '%(body)s'\n'n", {"id": instance_id, "req": req, "body": body}) context = req.environ[wsgi.CONTEXT_KEY] self.authorize_target_action( context, 'database:create', instance_id) schemas = body['databases'] context.notification = notification.DBaaSDatabaseCreate(context, request=req) with StartNotification(context, instance_id=instance_id, dbname=".".join([db['name'] for db in schemas])): try: model_schemas = populate_validated_databases(schemas) models.Schema.create(context, instance_id, model_schemas) except (ValueError, AttributeError) as e: raise exception.BadRequest(_("Database create error: %(e)s") % {'e': e}) return wsgi.Result(None, 202)
def create(self, req, body, tenant_id, instance_id): """Creates a set of schemas.""" LOG.info(_("Creating schema for instance '%s'") % instance_id) LOG.info(_("req : '%s'\n\n") % req) LOG.info(_("body : '%s'\n\n") % body) context = req.environ[wsgi.CONTEXT_KEY] schemas = body['databases'] context.notification = notification.DBaaSDatabaseCreate(context, request=req) with StartNotification(context, instance_id=instance_id, dbname=".".join([db['name'] for db in schemas])): model_schemas = populate_validated_databases(schemas) models.Schema.create(context, instance_id, model_schemas) return wsgi.Result(None, 202)