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

[Xen-changelog] Change boolean config option parsing to allow True and Y and similar useful



# HG changeset patch
# User emellor@ewan
# Node ID 6e5463aec499333e9d4f91f612981aeb1f576445
# Parent  a37a4abc11917196061b9da8bb026eac9153ef25
Change boolean config option parsing to allow True and Y and similar useful
things.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r a37a4abc1191 -r 6e5463aec499 tools/python/xen/xend/XendRoot.py
--- a/tools/python/xen/xend/XendRoot.py Wed Oct  5 16:07:01 2005
+++ b/tools/python/xen/xend/XendRoot.py Wed Oct  5 16:48:36 2005
@@ -26,6 +26,7 @@
 
 import os
 import os.path
+import string
 import sys
 
 from XendLogging import XendLogging
@@ -238,10 +239,10 @@
         return sxp.child_value(self.config, name, val=val)
 
     def get_config_bool(self, name, val=None):
-        v = self.get_config_value(name, val)
-        if v in ['yes', '1', 'on', 'true', 1, True]:
+        v = string.lower(str(self.get_config_value(name, val)))
+        if v in ['yes', 'y', '1', 'on',  'true',  't']:
             return True
-        if v in ['no', '0', 'off', 'false', 0, False]:
+        if v in ['no',  'n', '0', 'off', 'false', 'f']:
             return False
         raise XendError("invalid xend config %s: expected bool: %s" % (name, 
v))
 

_______________________________________________
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®.