Alon Bar-Lev has uploaded a new change for review.

Change subject: packaging: setup: support older psycopg2
......................................................................

packaging: setup: support older psycopg2

rhel and centos have version 2.0.14 with autocommit unsupported.

Change-Id: Icf94f83d3ebf5d121ef7bff3552bccfa09a99ec1
Signed-off-by: Alon Bar-Lev <alo...@redhat.com>
---
M packaging/setup/ovirt_engine_setup/database.py
1 file changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/58/15358/1

diff --git a/packaging/setup/ovirt_engine_setup/database.py 
b/packaging/setup/ovirt_engine_setup/database.py
index ea9cff2..19403f0 100644
--- a/packaging/setup/ovirt_engine_setup/database.py
+++ b/packaging/setup/ovirt_engine_setup/database.py
@@ -109,8 +109,15 @@
                     database=database,
                     sslmode=sslmode,
                 )
-                if not transaction:
+
+            if not transaction:
+                # autocommit member is available at >= 2.4.2
+                if hasattr(connection, 'autocommit'):
                     connection.autocommit = True
+                else:
+                    connection.set_isolation_level(
+                        psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT
+                    )
 
             cursor = connection.cursor()
             cursor.execute(


--
To view, visit http://gerrit.ovirt.org/15358
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf94f83d3ebf5d121ef7bff3552bccfa09a99ec1
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to