From d2a0f9fa235f6cf1e403a555f1ccce5323a5ea45 Mon Sep 17 00:00:00 2001 From: Michiel Nauta Date: Mon, 14 Feb 2011 20:19:44 +0000 Subject: [PATCH] Properly close database environment upon open failure svn: r16618 --- src/gen/db/write.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gen/db/write.py b/src/gen/db/write.py index 6b367cb57..13f8655fb 100644 --- a/src/gen/db/write.py +++ b/src/gen/db/write.py @@ -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