[PATCH] issue #454: Properly display storage volumes in a pool with sub-directories

Kimchi controller allows filterting the resources according to their parameters, but the filter data type may vary: string, list, regex. When using re.match() to valid the regex we need to make sure the value is a string, otherwise we will face the error: File "/usr/lib64/python2.6/re.py", line 137, in match return _compile(pattern, flags).match(string) File "/usr/lib64/python2.6/re.py", line 232, in _compile p = _cache.get(cachekey) TypeError: unhashable type: 'list' Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- src/kimchi/control/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kimchi/control/base.py b/src/kimchi/control/base.py index 2e0816f..1eb10bd 100644 --- a/src/kimchi/control/base.py +++ b/src/kimchi/control/base.py @@ -277,7 +277,7 @@ class Collection(object): if all(key in res.data and (res.data[key] == val or res.data[key] in val or - re.match(val, res.data[key])) + re.match(str(val), res.data[key])) for key, val in fields_filter.iteritems()): data.append(res.data) return data -- 1.9.3

Tested by Yu Xin Huo. On 9/25/2014 10:50 AM, Aline Manera wrote:
Kimchi controller allows filterting the resources according to their parameters, but the filter data type may vary: string, list, regex.
When using re.match() to valid the regex we need to make sure the value is a string, otherwise we will face the error:
File "/usr/lib64/python2.6/re.py", line 137, in match return _compile(pattern, flags).match(string) File "/usr/lib64/python2.6/re.py", line 232, in _compile p = _cache.get(cachekey) TypeError: unhashable type: 'list'
Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- src/kimchi/control/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/kimchi/control/base.py b/src/kimchi/control/base.py index 2e0816f..1eb10bd 100644 --- a/src/kimchi/control/base.py +++ b/src/kimchi/control/base.py @@ -277,7 +277,7 @@ class Collection(object):
if all(key in res.data and (res.data[key] == val or res.data[key] in val or - re.match(val, res.data[key])) + re.match(str(val), res.data[key])) for key, val in fields_filter.iteritems()): data.append(res.data) return data

Reviewed-by: Crístian Viana <vianac@linux.vnet.ibm.com> Tested-by: Crístian Viana <vianac@linux.vnet.ibm.com> On 24-09-2014 23:50, Aline Manera wrote:
Kimchi controller allows filterting the resources according to their parameters, but the filter data type may vary: string, list, regex.
When using re.match() to valid the regex we need to make sure the value is a string, otherwise we will face the error:
File "/usr/lib64/python2.6/re.py", line 137, in match return _compile(pattern, flags).match(string) File "/usr/lib64/python2.6/re.py", line 232, in _compile p = _cache.get(cachekey) TypeError: unhashable type: 'list'
Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com>
participants (3)
-
Aline Manera
-
Crístian Viana
-
Yu Xin Huo