From a6df9ca354ed4f7e1e569a0c858dbc3b6e68faa1 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Thu, 17 Mar 2011 08:57:08 -0500 Subject: 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 --- src/sbin/bcfg2-reports | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3-1-g7c22