[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-3.0.3-testing] [XM] Fix error reporting for resources.py, remove duplicate try block.



# HG changeset patch
# User atse@xxxxxxxxxxxxxxxxxxxxxxxx
# Date 1159442171 -3600
# Node ID 0de76117acb6116354b221eba8d322ae1190f2f7
# Parent  911b7c6d03eaea5037fc269424fdbfed4258a161
[XM] Fix error reporting for resources.py, remove duplicate try block.

Also fixed usage message to not include misspelling of the command.

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/xen/xm/resources.py |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)

diff -r 911b7c6d03ea -r 0de76117acb6 tools/python/xen/xm/resources.py
--- a/tools/python/xen/xm/resources.py  Thu Sep 28 11:50:51 2006 +0100
+++ b/tools/python/xen/xm/resources.py  Thu Sep 28 12:16:11 2006 +0100
@@ -24,7 +24,7 @@ from xen.xm.opts import OptionError
 from xen.xm.opts import OptionError
 
 def help():
-    return """Usage: xm resource
+    return """
     This program lists information for each resource in the
     global resource label file."""
 
@@ -45,18 +45,13 @@ def main (argv):
         filename = security.res_label_filename
         access_control = dictio.dict_read("resources", filename)
     except:
-        print "Resource file not found."
-        return
+        raise OptionError("Resource file not found")
 
-        try:
-            file = security.res_label_filename
-            access_control = dictio.dict_read("resources", file)
-        except:
-            security.err("Error reading resource file.")
-
-        print_resource_data(access_control)
+    print_resource_data(access_control)
 
 if __name__ == '__main__':
-    main(sys.argv)
-
-
+    try:
+        main(sys.argv)
+    except Exception, e:
+        sys.stderr.write('Error: %s\n' % str(e))
+        sys.exit(-1)    

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.