From 487384fcc864ef1955f99cdf713cf5c2d77ec023 Mon Sep 17 00:00:00 2001 From: Boris Pavlovic Date: Mon, 28 Jan 2013 17:16:15 +0400 Subject: Fix missing wrap_db_error for Session.execute() method We should add wrap_db_error for Session.execute() method, because Query.update() method will call Session.execute() and it is not inside Session.flush(), so exceptions from Query.update() wouldn't be wrapped. Add test for Session.flush() wrapper Add test for Session.execute() wrapper Fixes bug 1107890 Change-Id: I96894e502f9f279999b61a1e66469e34a07a022d --- nova/db/sqlalchemy/session.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'nova/db') diff --git a/nova/db/sqlalchemy/session.py b/nova/db/sqlalchemy/session.py index eb5d8016f..94f3d2a7c 100644 --- a/nova/db/sqlalchemy/session.py +++ b/nova/db/sqlalchemy/session.py @@ -550,6 +550,10 @@ class Session(sqlalchemy.orm.session.Session): def flush(self, *args, **kwargs): return super(Session, self).flush(*args, **kwargs) + @wrap_db_error + def execute(self, *args, **kwargs): + return super(Session, self).execute(*args, **kwargs) + def get_maker(engine, autocommit=True, expire_on_commit=False): """Return a SQLAlchemy sessionmaker using the given engine.""" -- cgit