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
This commit is contained in:
Eric Harney 2017-05-20 15:10:47 -04:00 committed by TommyLike
parent 9ea2e61cc1
commit b910f5bea3
2 changed files with 12 additions and 7 deletions

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2013 OpenStack Foundation
# All Rights Reserved.
#
@ -99,6 +100,10 @@ class ShellTest(utils.TestCase):
'list --filters name~=456',
'expected':
'/volumes/detail?name%7E=456'},
{'command':
u'list --filters name~=Σ',
'expected':
'/volumes/detail?name%7E=%CE%A3'},
# testcases for list group
{'command':
'group-list --filters name=456',

View File

@ -98,7 +98,7 @@ def do_list_filters(cs, args):
'Valid keys: %s. '
'Default=None.') % ', '.join(base.SORT_KEY_VALUES)))
@utils.arg('--filters',
type=str,
type=six.text_type,
nargs='*',
start_version='3.33',
metavar='<key=value>',
@ -273,7 +273,7 @@ RESET_STATE_RESOURCES = {'volume': utils.find_volume,
metavar='<tenant>',
help='Display information from single tenant (Admin only).')
@utils.arg('--filters',
type=str,
type=six.text_type,
nargs='*',
start_version='3.33',
metavar='<key=value>',
@ -976,7 +976,7 @@ def do_manageable_list(cs, args):
default=utils.env('ALL_TENANTS', default=0),
help='Shows details for all tenants. Admin only.')
@utils.arg('--filters',
type=str,
type=six.text_type,
nargs='*',
start_version='3.33',
metavar='<key=value>',
@ -1192,7 +1192,7 @@ def do_group_update(cs, args):
help="Filters results by a group ID. Default=None. "
"%s" % FILTER_DEPRECATED)
@utils.arg('--filters',
type=str,
type=six.text_type,
nargs='*',
start_version='3.33',
metavar='<key=value>',
@ -1418,7 +1418,7 @@ def do_api_version(cs, args):
help="Filters results by the message level. Default=None. "
"%s" % FILTER_DEPRECATED)
@utils.arg('--filters',
type=str,
type=six.text_type,
nargs='*',
start_version='3.33',
metavar='<key=value>',
@ -1556,7 +1556,7 @@ def do_message_delete(cs, args):
"volume api version >=3.22. Default=None. "
"%s" % FILTER_DEPRECATED)
@utils.arg('--filters',
type=str,
type=six.text_type,
nargs='*',
start_version='3.33',
metavar='<key=value>',
@ -1647,7 +1647,7 @@ def do_snapshot_list(cs, args):
metavar='<tenant>',
help='Display information from single tenant (Admin only).')
@utils.arg('--filters',
type=str,
type=six.text_type,
nargs='*',
start_version='3.33',
metavar='<key=value>',