# HG changeset patch # User cmlenz # Date 1125428174 0 # Node ID f7c2f112afe6714b114832d147e90407c96b2d64 # Parent 79c61c26a4e11c9072d9645f19d4c957905dd6ed Fix the BDB XML upgrade procedure: If a document is found that is associated with a non-existing build, just remove it. diff --git a/bitten/upgrades.py b/bitten/upgrades.py --- a/bitten/upgrades.py +++ b/bitten/upgrades.py @@ -75,8 +75,12 @@ if doc.getMetaData('', 'build', metaval): build_id = int(metaval.asNumber()) build = Build.fetch(env, id=build_id, db=db) - doc.setMetaData('', 'config', dbxml.XmlValue(build.config)) - container.updateDocument(doc, uc) + if build: + doc.setMetaData('', 'config', dbxml.XmlValue(build.config)) + container.updateDocument(doc, uc) + else: + # an orphaned report, for whatever reason... just remove it + container.deleteDocument(doc, uc) map = { 2: [add_log_table],