aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authoremellor@ewan <emellor@ewan>2005-10-05 17:48:36 +0100
committeremellor@ewan <emellor@ewan>2005-10-05 17:48:36 +0100
commitd4d9c86a251bf515644be60ea8375bd7e45c419f (patch)
treef5186bda5d58d868ecafc4a8719743af4541c4cd /tools
parent66c12e28e9019efa813537f984d4214ffd64df3b (diff)
downloadxen-d4d9c86a251bf515644be60ea8375bd7e45c419f.tar.gz
xen-d4d9c86a251bf515644be60ea8375bd7e45c419f.tar.bz2
xen-d4d9c86a251bf515644be60ea8375bd7e45c419f.zip
Change boolean config option parsing to allow True and Y and similar useful
things. Signed-off-by: Ewan Mellor <ewan@xensource.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/python/xen/xend/XendRoot.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/python/xen/xend/XendRoot.py b/tools/python/xen/xend/XendRoot.py
index 5162163cba..f170b1192b 100644
--- a/tools/python/xen/xend/XendRoot.py
+++ b/tools/python/xen/xend/XendRoot.py
@@ -26,6 +26,7 @@ configured values.
import os
import os.path
+import string
import sys
from XendLogging import XendLogging
@@ -238,10 +239,10 @@ class XendRoot:
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))