commit 8c12f9fa8ed4ac50499b42ac77dac190eddc0913
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Tue Aug 6 13:40:57 2013 +0200
utils: Extend bool_it to support yes/no
We are using yes/no for some boolean values within the recipe. This
patch extends the bool_it function, so it can be used to handle the
conversions instead of any other approaches.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Common/Utils.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/lnst/Common/Utils.py b/lnst/Common/Utils.py
index b2315f8..c3acafb 100644
--- a/lnst/Common/Utils.py
+++ b/lnst/Common/Utils.py
@@ -85,9 +85,9 @@ def int_it(val):
def bool_it(val):
if isinstance(val, str):
- if re.match("^\s*(?i)(true)", val):
+ if re.match("^\s*(?i)(true)", val) or
re.match("^\s*(?i)(yes)", val):
return True
- elif re.match("^\s*(?i)(false)", val):
+ elif re.match("^\s*(?i)(false)", val) or
re.match("^\s*(?i)(no)", val):
return False
return True if int_it(val) else False
Show replies by date