From 01191702698ed4015de0424f7db229aeb2d391e9 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Sun, 6 May 2012 13:01:52 -0500 Subject: reports: Fix bcfg2-admin reports init Signed-off-by: Sol Jerome --- src/lib/Bcfg2/Server/Reports/updatefix.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/lib/Bcfg2/Server/Reports/updatefix.py') diff --git a/src/lib/Bcfg2/Server/Reports/updatefix.py b/src/lib/Bcfg2/Server/Reports/updatefix.py index 39fc10b56..d02e88b1a 100644 --- a/src/lib/Bcfg2/Server/Reports/updatefix.py +++ b/src/lib/Bcfg2/Server/Reports/updatefix.py @@ -67,9 +67,15 @@ def _remove_table_column(tbl, col): cursor.execute('alter table %s ' 'drop column %s;' % (tbl, col)) except DatabaseError: + # check if table exists + try: + cursor.execute('select * from sqlite_master where name=%s and type="table";' % tbl) + except DatabaseError: + # table doesn't exist + return + # sqlite wants us to create a new table containing the columns we want # and copy into it http://www.sqlite.org/faq.html#q11 - tmptbl_name = "t_backup" _tmptbl_create = \ """create temporary table "%s" ( -- cgit v1.2.3-1-g7c22