summaryrefslogtreecommitdiff
path: root/tooz/drivers/pgsql.py
diff options
context:
space:
mode:
authorJulien Danjou <julien@danjou.info>2015-11-26 14:32:49 +0100
committerJulien Danjou <julien@danjou.info>2015-11-27 12:13:31 +0100
commitdf3363e2ea86cf2c19d315fa7bddae7d584afdf3 (patch)
treeabb007af34b9c9787fbdf796f67fdde51af7bd20 /tooz/drivers/pgsql.py
parentd272845997b9f2e13181b82a1c79effed5211e8a (diff)
downloadtooz-df3363e2ea86cf2c19d315fa7bddae7d584afdf3.tar.gz
{pg,my}sql: fix AttributeError on connection failure
If connection fails to be established, the acquired attribute does not exist and then you see warning such has: Exception AttributeError: "'MySQLLock' object has no attribute 'acquired'" in <bound method MySQLLock.__del__ of <tooz.drivers.mysql.MySQLLock object at 0x7f79479056d0>> Change-Id: Id61775483c91ba4127d9dd8cb56d6629a51d7081
Diffstat (limited to 'tooz/drivers/pgsql.py')
-rw-r--r--tooz/drivers/pgsql.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tooz/drivers/pgsql.py b/tooz/drivers/pgsql.py
index 0cea947..df644f0 100644
--- a/tooz/drivers/pgsql.py
+++ b/tooz/drivers/pgsql.py
@@ -93,8 +93,8 @@ class PostgresLock(locking.Lock):
def __init__(self, name, parsed_url, options):
super(PostgresLock, self).__init__(name)
- self._conn = PostgresDriver.get_connection(parsed_url, options)
self.acquired = False
+ self._conn = PostgresDriver.get_connection(parsed_url, options)
h = hashlib.md5()
h.update(name)
if six.PY2: