summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-12-01 14:05:53 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-12-01 14:05:53 +0000
commitd0cd2ba44a52ef3c458fa80544692d930f9d5341 (patch)
tree449959dcfd913094430dba382ad6cb786b17d7cd
parent9ecb8d6f50c6b065a4bc72ccf07d3b4e6df34917 (diff)
downloadbcfg2-d0cd2ba44a52ef3c458fa80544692d930f9d5341.tar.gz
bcfg2-d0cd2ba44a52ef3c458fa80544692d930f9d5341.tar.bz2
bcfg2-d0cd2ba44a52ef3c458fa80544692d930f9d5341.zip
Cleanly handle config file parse failures (Resolves Ticket #493) [bugfix]
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4018 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--src/lib/Options.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/Options.py b/src/lib/Options.py
index 02815ba24..ac3d1d681 100644
--- a/src/lib/Options.py
+++ b/src/lib/Options.py
@@ -54,7 +54,11 @@ class BasicOptionParser:
raise SystemExit, 1
if self.configfile:
cf = ConfigParser.ConfigParser()
- cf.read(self.configfile)
+ try:
+ cf.read(self.configfile)
+ except Exception, e:
+ print "Failed to read configfile: %s\n%s" % (self.configfile, e)
+ raise SystemExit, 1
for key, (option, envvar, cfpath, default, boolean) in self.optionspec.iteritems():
if self.dogetopt:
optinfo = [opt[1] for opt in opts if opt[0] == option[0]]