summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Admin/Reports.py
diff options
context:
space:
mode:
authorTim Laszlo <tim.laszlo@gmail.com>2012-06-01 09:00:00 -0500
committerTim Laszlo <tim.laszlo@gmail.com>2012-06-01 09:04:42 -0500
commitb9c8a6c4c0245db0515a164f1b89247688e3b4fa (patch)
tree4565843b30bef6ede7a58cff2ebf209f37eabfdd /src/lib/Bcfg2/Server/Admin/Reports.py
parenteae8bbd6d211d711be4f414f108aa597b38891e0 (diff)
downloadbcfg2-b9c8a6c4c0245db0515a164f1b89247688e3b4fa.tar.gz
bcfg2-b9c8a6c4c0245db0515a164f1b89247688e3b4fa.tar.bz2
bcfg2-b9c8a6c4c0245db0515a164f1b89247688e3b4fa.zip
DBStats: New db update routines
Replace updatefix.py with the Updater class. This streamlines some of the common tasks and groups database updates by release. Upgrades from pre 1.1.x are no longer supported.
Diffstat (limited to 'src/lib/Bcfg2/Server/Admin/Reports.py')
-rw-r--r--src/lib/Bcfg2/Server/Admin/Reports.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/lib/Bcfg2/Server/Admin/Reports.py b/src/lib/Bcfg2/Server/Admin/Reports.py
index 041eacccc..97db140b7 100644
--- a/src/lib/Bcfg2/Server/Admin/Reports.py
+++ b/src/lib/Bcfg2/Server/Admin/Reports.py
@@ -26,7 +26,7 @@ import Bcfg2.Server.Reports.settings
# Load django and reports stuff _after_ we know we can load settings
import django.core.management
from Bcfg2.Server.Reports.importscript import load_stats
-from Bcfg2.Server.Reports.updatefix import update_database
+from Bcfg2.Server.Reports.Updater import update_database, UpdaterError
from Bcfg2.Server.Reports.utils import *
project_directory = os.path.dirname(Bcfg2.Server.Reports.settings.__file__)
@@ -111,10 +111,14 @@ class Reports(Bcfg2.Server.Admin.Mode):
self.django_command_proxy(args[0])
elif args[0] == 'scrub':
self.scrub()
- elif args[0] == 'init':
- update_database()
- elif args[0] == 'update':
- update_database()
+ elif args[0] in ['init', 'update']:
+ try:
+ update_database()
+ #except SchemaTooOldError:
+ # logger.error("Sc
+ except UpdaterError:
+ print "Update failed"
+ raise SystemExit(-1)
elif args[0] == 'load_stats':
quick = '-O3' in args
stats_file = None
@@ -266,6 +270,8 @@ class Reports(Bcfg2.Server.Admin.Mode):
self.log,
quick=quick,
location=platform.node())
+ except UpdaterError:
+ self.errExit("StatReports: Database updater failed")
except:
pass