diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2007-03-21 03:33:47 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2007-03-21 03:33:47 +0000 |
commit | 80a1ff44319b53f43ca664609442467caeab414b (patch) | |
tree | 2ca15800d0d8ac3f778a0bcff70a0699146b410a /src | |
parent | 1f9efe807ed2a4bba94b2dcf303d4e1ab0ca416e (diff) | |
download | bcfg2-80a1ff44319b53f43ca664609442467caeab414b.tar.gz bcfg2-80a1ff44319b53f43ca664609442467caeab414b.tar.bz2 bcfg2-80a1ff44319b53f43ca664609442467caeab414b.zip |
Add error handling to bcfg2-admin compare (Resolves Ticket #409)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2976 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rwxr-xr-x | src/sbin/bcfg2-admin | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/sbin/bcfg2-admin b/src/sbin/bcfg2-admin index 2a570df56..52525e072 100755 --- a/src/sbin/bcfg2-admin +++ b/src/sbin/bcfg2-admin @@ -236,8 +236,18 @@ def do_compare(cargs): print "Usage: bcfg2-admin compare <old> <new>" raise SystemExit - new = lxml.etree.parse(new).getroot() - old = lxml.etree.parse(old).getroot() + try: + new = lxml.etree.parse(new).getroot() + except IOError: + print "Failed to read %s" % (new) + raise SystemExit, 1 + + try: + old = lxml.etree.parse(old).getroot() + except IOError: + print "Failed to read %s" % (old) + raise SystemExit, 1 + for src in [new, old]: for bundle in src.findall('./Bundle'): if bundle.get('name')[-4:] == '.xml': |