Skip to content

Commit b910f5b

Browse files
eharneyTommyLike
authored andcommitted
Unicode value support for "--filters"
These need to support Unicode values, like our API does. Otherwise the shell client does not work for non-ascii names, etc. Closes-Bug: #1695927 Change-Id: Ib661bb6f8df62084bdf80e7666de5708d13674b7
1 parent 9ea2e61 commit b910f5b

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

cinderclient/tests/unit/v3/test_shell.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
# Copyright (c) 2013 OpenStack Foundation
23
# All Rights Reserved.
34
#
@@ -99,6 +100,10 @@ def test_list_filters(self, resource, query_url):
99100
'list --filters name~=456',
100101
'expected':
101102
'/volumes/detail?name%7E=456'},
103+
{'command':
104+
u'list --filters name~=Σ',
105+
'expected':
106+
'/volumes/detail?name%7E=%CE%A3'},
102107
# testcases for list group
103108
{'command':
104109
'group-list --filters name=456',

cinderclient/v3/shell.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def do_list_filters(cs, args):
9898
'Valid keys: %s. '
9999
'Default=None.') % ', '.join(base.SORT_KEY_VALUES)))
100100
@utils.arg('--filters',
101-
type=str,
101+
type=six.text_type,
102102
nargs='*',
103103
start_version='3.33',
104104
metavar='<key=value>',
@@ -273,7 +273,7 @@ def do_get_pools(cs, args):
273273
metavar='<tenant>',
274274
help='Display information from single tenant (Admin only).')
275275
@utils.arg('--filters',
276-
type=str,
276+
type=six.text_type,
277277
nargs='*',
278278
start_version='3.33',
279279
metavar='<key=value>',
@@ -976,7 +976,7 @@ def do_manageable_list(cs, args):
976976
default=utils.env('ALL_TENANTS', default=0),
977977
help='Shows details for all tenants. Admin only.')
978978
@utils.arg('--filters',
979-
type=str,
979+
type=six.text_type,
980980
nargs='*',
981981
start_version='3.33',
982982
metavar='<key=value>',
@@ -1192,7 +1192,7 @@ def do_group_update(cs, args):
11921192
help="Filters results by a group ID. Default=None. "
11931193
"%s" % FILTER_DEPRECATED)
11941194
@utils.arg('--filters',
1195-
type=str,
1195+
type=six.text_type,
11961196
nargs='*',
11971197
start_version='3.33',
11981198
metavar='<key=value>',
@@ -1418,7 +1418,7 @@ def do_api_version(cs, args):
14181418
help="Filters results by the message level. Default=None. "
14191419
"%s" % FILTER_DEPRECATED)
14201420
@utils.arg('--filters',
1421-
type=str,
1421+
type=six.text_type,
14221422
nargs='*',
14231423
start_version='3.33',
14241424
metavar='<key=value>',
@@ -1556,7 +1556,7 @@ def do_message_delete(cs, args):
15561556
"volume api version >=3.22. Default=None. "
15571557
"%s" % FILTER_DEPRECATED)
15581558
@utils.arg('--filters',
1559-
type=str,
1559+
type=six.text_type,
15601560
nargs='*',
15611561
start_version='3.33',
15621562
metavar='<key=value>',
@@ -1647,7 +1647,7 @@ def do_snapshot_list(cs, args):
16471647
metavar='<tenant>',
16481648
help='Display information from single tenant (Admin only).')
16491649
@utils.arg('--filters',
1650-
type=str,
1650+
type=six.text_type,
16511651
nargs='*',
16521652
start_version='3.33',
16531653
metavar='<key=value>',

0 commit comments

Comments
 (0)