diff options
author | Chaynika Saikia <csaikia@asu.edu> | 2017-06-21 16:33:49 -0400 |
---|---|---|
committer | Chaynika Saikia <csaikia@asu.edu> | 2017-06-21 16:59:28 -0400 |
commit | f38c8c5df83b50fd3ef38f3db2456b54294ee0aa (patch) | |
tree | c3a383c220e28951fe74b6be8a25d7b17f308ff0 /cinderclient/shell_utils.py | |
parent | 71dfec67434ab9108a5faeee094d0225a5970e0a (diff) | |
download | python-cinderclient-f38c8c5df83b50fd3ef38f3db2456b54294ee0aa.tar.gz |
UnboundLocalError on message-list
This bug for 'cinder message-list' has been fixed such that now
if the user gives wrong filters, then the command properly
prints WARNING message saying it is ignoring that filter. Previously,
for wrong filters which were not passed in the correct usage format,
the 'cinder message-list --filters' command was giving UnboundLocalError
exception.
The extract_filters() method was previously assuming that all the
message filters passed were in the format "<filter_name>=<value>",
because of which if the user passed something like:
'cinder message-list --filters event_id:VOLUME_000002'
an UnboundLocalError was thrown.
The changes are made to the method such that if the user passes a
filter in invalid format, the cinder CLI ignores that filter while
providing the output.
Closes-Bug: #1696556
Change-Id: I545b3f28e545b380842ea003dc38ad70cb413aee
Diffstat (limited to 'cinderclient/shell_utils.py')
-rw-r--r-- | cinderclient/shell_utils.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cinderclient/shell_utils.py b/cinderclient/shell_utils.py index 4cb676b..0bfecae 100644 --- a/cinderclient/shell_utils.py +++ b/cinderclient/shell_utils.py @@ -151,7 +151,9 @@ def extract_filters(args): (key, value) = f.split('=', 1) if value.startswith('{') and value.endswith('}'): value = _build_internal_dict(value[1:-1]) - filters[key] = value + filters[key] = value + else: + print("WARNING: Ignoring the filter %s while showing result." % f) return filters |