ia64/xen-unstable
changeset 7230:6e5463aec499
Change boolean config option parsing to allow True and Y and similar useful
things.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
things.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
author | emellor@ewan |
---|---|
date | Wed Oct 05 17:48:36 2005 +0100 (2005-10-05) |
parents | a37a4abc1191 |
children | 6f71824a45c1 |
files | tools/python/xen/xend/XendRoot.py |
line diff
1.1 --- a/tools/python/xen/xend/XendRoot.py Wed Oct 05 17:07:01 2005 +0100 1.2 +++ b/tools/python/xen/xend/XendRoot.py Wed Oct 05 17:48:36 2005 +0100 1.3 @@ -26,6 +26,7 @@ configured values. 1.4 1.5 import os 1.6 import os.path 1.7 +import string 1.8 import sys 1.9 1.10 from XendLogging import XendLogging 1.11 @@ -238,10 +239,10 @@ class XendRoot: 1.12 return sxp.child_value(self.config, name, val=val) 1.13 1.14 def get_config_bool(self, name, val=None): 1.15 - v = self.get_config_value(name, val) 1.16 - if v in ['yes', '1', 'on', 'true', 1, True]: 1.17 + v = string.lower(str(self.get_config_value(name, val))) 1.18 + if v in ['yes', 'y', '1', 'on', 'true', 't']: 1.19 return True 1.20 - if v in ['no', '0', 'off', 'false', 0, False]: 1.21 + if v in ['no', 'n', '0', 'off', 'false', 'f']: 1.22 return False 1.23 raise XendError("invalid xend config %s: expected bool: %s" % (name, v)) 1.24