Protect from crash when attempting to read status of DB

svn: r11623
This commit is contained in:
Doug Blank 2009-01-14 03:09:03 +00:00
parent bef2ea3b4c
commit 71be10c1bc

View File

@ -139,7 +139,10 @@ class CLIDbManager:
return "Unknown", "Unknown" return "Unknown", "Unknown"
dbmap1 = dbshelve.DBShelf(env) dbmap1 = dbshelve.DBShelf(env)
fname = os.path.join(file_name, META + ".db") fname = os.path.join(file_name, META + ".db")
dbmap1.open(fname, META, db.DB_HASH, db.DB_RDONLY) try:
dbmap1.open(fname, META, db.DB_HASH, db.DB_RDONLY)
except:
return "Unknown", "Unknown"
version = dbmap1.get('version', default=None) version = dbmap1.get('version', default=None)
dbmap1.close() dbmap1.close()
dbmap2 = dbshelve.DBShelf(env) dbmap2 = dbshelve.DBShelf(env)