summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2008-08-21 20:39:53 +0000
committerNarayan Desai <desai@mcs.anl.gov>2008-08-21 20:39:53 +0000
commit156950c2f3822ecba05e526d1949f65d364f6675 (patch)
tree572bd1e588cfda94d49454eb580e2a2c1eef5ebf /src/lib
parent368713348404468a62ad14f0e58339c6a5255d8a (diff)
downloadbcfg2-156950c2f3822ecba05e526d1949f65d364f6675.tar.gz
bcfg2-156950c2f3822ecba05e526d1949f65d364f6675.tar.bz2
bcfg2-156950c2f3822ecba05e526d1949f65d364f6675.zip
Fix for missing update_map keys (patch from sousignant, report from solj)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4887 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Server/Reports/updatefix.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/Server/Reports/updatefix.py b/src/lib/Server/Reports/updatefix.py
index 48077e44b..dbcce6d08 100644
--- a/src/lib/Server/Reports/updatefix.py
+++ b/src/lib/Server/Reports/updatefix.py
@@ -11,6 +11,7 @@ logger = logging.getLogger('Bcfg2.Server.Reports.UpdateFix')
def _merge_database_table_entries():
cursor = connection.cursor()
insert_cursor = connection.cursor()
+ find_cursor = connection.cursor()
cursor.execute("""
Select name, kind from reports_bad
union
@@ -36,7 +37,13 @@ def _merge_database_table_entries():
inner join reports_extra_interactions on reports_extra.id=reports_extra_interactions.extra_id
""")
for row in cursor.fetchall():
- entry_id = entries_map[(row[0], row[1])]
+ key = (row[0], row[1])
+ if entries_map.get(key, None):
+ entry_id = entries_map[key]
+ else:
+ find_cursor.execute("Select id from reports_entries where name=%s and kind=%s", key)
+ row = find_cursor.fetchone()
+ entry_id = row[0]
insert_cursor.execute("insert into reports_entries_interactions \
(entry_id, interaction_id, reason_id, type) values (%s, %s, %s, %s)", (entry_id, row[3], row[2], row[4]))