From 2fb414157258ed0eb537bde8314feef2b952db2b Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Tue, 31 Aug 2004 19:02:04 +0000 Subject: add error handling (Logical change 1.50) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@292 ce84e21b-d406-0410-9b95-82705330c041 --- src/sbin/bcfg2 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sbin/bcfg2 b/src/sbin/bcfg2 index 8ed4bbbc3..1741e748b 100644 --- a/src/sbin/bcfg2 +++ b/src/sbin/bcfg2 @@ -1,9 +1,10 @@ #!/usr/bin/env python from getopt import getopt, GetoptError from os import popen, chmod, unlink -from sys import argv, exit +from sys import argv, exit, exc_info from string import join from tempfile import mktemp +from traceback import extract_tb from elementtree.ElementTree import Element, XML, tostring @@ -117,7 +118,16 @@ if __name__ == '__main__': for entry in [k for (k,v) in entrystate.iteritems() if not v]: method = getattr(toolset, "Install%s"%(entry.tag)) - entrystate[entry] = method(entry) + try: + entrystate[entry] = method(entry) + except: + print "Install failed for %s"%(tostring(entry)) + (t,v,tb) = exc_info() + print "Unexpected failure in Install:" + for line in extract_tb(tb): + print "File %s, line %i, in %s\n %s\n"%(line) + print "%s: %s\n"%(t,v) + del t,v,tb for structure in structurestate.keys(): if structurestate[structure]: -- cgit v1.2.3-1-g7c22