summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSol Jerome <sol.jerome@gmail.com>2011-03-17 08:57:08 -0500
committerSol Jerome <sol.jerome@gmail.com>2011-03-17 08:57:08 -0500
commita6df9ca354ed4f7e1e569a0c858dbc3b6e68faa1 (patch)
tree426dddbcee9504ce8abf25eb8eccdee97dc51e63
parent0984e097c2f7d973320fa14fcfab36d3122cfaf0 (diff)
downloadbcfg2-a6df9ca354ed4f7e1e569a0c858dbc3b6e68faa1.tar.gz
bcfg2-a6df9ca354ed4f7e1e569a0c858dbc3b6e68faa1.tar.bz2
bcfg2-a6df9ca354ed4f7e1e569a0c858dbc3b6e68faa1.zip
bcfg2-reports: Fail gracefully when missing statistics
This fix is to address the traceback at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=608613. We need to inform the user about the [statistics] section in bcfg2.conf so that they can go and find the necessary information needed to set up reports. Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
-rwxr-xr-xsrc/sbin/bcfg2-reports8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/sbin/bcfg2-reports b/src/sbin/bcfg2-reports
index d83e45e7c..559e9fb43 100755
--- a/src/sbin/bcfg2-reports
+++ b/src/sbin/bcfg2-reports
@@ -5,7 +5,13 @@ __revision__ = '$Revision$'
import os
import sys
-import Bcfg2.Server.Reports.settings
+try:
+ import Bcfg2.Server.Reports.settings
+except ConfigParser.NoSectionError:
+ print("Your bcfg2.conf is currently missing the statistics section which "
+ "is necessary for the reporting interface. Please see bcfg2.conf(5) "
+ "for more details.")
+ sys.exit(1)
project_directory = os.path.dirname(Bcfg2.Server.Reports.settings.__file__)
project_name = os.path.basename(project_directory)