Properly close database environment upon open failure

svn: r16618
This commit is contained in:
Michiel Nauta 2011-02-14 20:19:44 +00:00
parent 5d97da751f
commit d2a0f9fa23

View File

@ -1008,7 +1008,8 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
Bail out if the incompatible version is discovered:
* close cleanly to not damage data/env
"""
self.metadata.close()
if hasattr(self, 'metadata') and self.metadata:
self.metadata.close()
self.env.close()
self.metadata = None
self.env = None