From e59df24809fbd54436839303cbd13f0717c9ced2 Mon Sep 17 00:00:00 2001
From: Gorka Eguileor <geguileo@redhat.com>
Date: Mon, 14 Dec 2015 16:02:20 +0100
Subject: [PATCH] Refactor cinder.utils.is_valid_boolstr

Method is_valid_boolstr is currently doing 8 different checks against
the same variable.  This patch refactors this method to be more pythonic
by using the in operator.

Change-Id: If77c3a80a5698685aa67120bcee2e223584f5d16
---
 cinder/utils.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/cinder/utils.py b/cinder/utils.py
index e2865a429..957ec5111 100644
--- a/cinder/utils.py
+++ b/cinder/utils.py
@@ -342,10 +342,7 @@ def safe_minidom_parse_string(xml_string):
 def is_valid_boolstr(val):
     """Check if the provided string is a valid bool string or not."""
     val = str(val).lower()
-    return (val == 'true' or val == 'false' or
-            val == 'yes' or val == 'no' or
-            val == 'y' or val == 'n' or
-            val == '1' or val == '0')
+    return val in ('true', 'false', 'yes', 'no', 'y', 'n', '1', '0')
 
 
 def is_none_string(val):
-- 
2.45.2