summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSol Jerome <sol.jerome@gmail.com>2012-05-06 13:01:52 -0500
committerSol Jerome <sol.jerome@gmail.com>2012-05-06 13:01:52 -0500
commit01191702698ed4015de0424f7db229aeb2d391e9 (patch)
tree8d67c8b381628f4ef117c4b07c817b1f083afdee
parent11cacbefea521fd106b572fe956130bd64af6c7b (diff)
downloadbcfg2-01191702698ed4015de0424f7db229aeb2d391e9.tar.gz
bcfg2-01191702698ed4015de0424f7db229aeb2d391e9.tar.bz2
bcfg2-01191702698ed4015de0424f7db229aeb2d391e9.zip
reports: Fix bcfg2-admin reports init
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
-rw-r--r--src/lib/Bcfg2/Server/Reports/updatefix.py8
1 files changed, 7 insertions, 1 deletions
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" (