Catch IOError when using local configuration files, to give better diagnostics.
authorEwan Mellor <ewan@xensource.com>
Mon, 6 Nov 2006 11:36:38 +0000 (11:36 +0000)
committerEwan Mellor <ewan@xensource.com>
Mon, 6 Nov 2006 11:36:38 +0000 (11:36 +0000)
Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/xm/create.py

index 1bb5171eef3a62a95417c818c96f4d3f77a8f547..d94356d5c55e630649b436673564025d94405738 100644 (file)
@@ -1200,7 +1200,10 @@ def main(argv):
         return
 
     if type(config) == str:
+        try:
             config = sxp.parse(file(config))[0]
+        except IOError, exn:
+            raise OptionError("Cannot read file %s: %s" % (config, exn[1]))
 
     if opts.vals.dryrun:
         PrettyPrint.prettyprint(config)