[migractions] Don't silently ignore errors when installing sql procedures
authorJulien Cristau <julien.cristau@logilab.fr>
Tue, 21 Jan 2014 11:57:02 +0100
changeset 9421 6b673cb4d3b6
parent 9420 3809e93c33b8
child 9422 5a4fba9a02d7
[migractions] Don't silently ignore errors when installing sql procedures If we're going to ignore errors, at least be loud about it. sqlexec already wraps the sql execution in a try/except block, so we were never going to catch any exceptions in the caller. Check the return value instead. Closes #3459618.
server/migractions.py
--- a/server/migractions.py	Tue Jan 21 10:20:49 2014 +0100
+++ b/server/migractions.py	Tue Jan 21 11:57:02 2014 +0100
@@ -395,11 +395,10 @@
         sql_scripts = glob(osp.join(directory, '*.%s.sql' % driver))
         for fpath in sql_scripts:
             print '-> installing', fpath
-            try:
-                sqlexec(open(fpath).read(), self.session.system_sql, False,
-                        delimiter=';;')
-            except Exception as exc:
-                print '-> ERROR:', exc, ', skipping', fpath
+            failed = sqlexec(open(fpath).read(), self.session.system_sql, False,
+                             delimiter=';;')
+            if failed:
+                print '-> ERROR, skipping', fpath
 
     # schema synchronization internals ########################################