diff options
| author | Sean McGinnis <sean.mcginnis@gmail.com> | 2019-04-18 13:53:57 -0500 |
|---|---|---|
| committer | Brian Rosmaita <rosmaita.fossdev@gmail.com> | 2019-09-11 09:38:34 -0400 |
| commit | 246040a7325164eb0c7c3171dd21ceb7c7d149ce (patch) | |
| tree | 2177cf3c1f9cfbff5b40df7d16beb7adf54bfb67 /cinderclient/base.py | |
| parent | 3c1b417959689c85a2f54505057ca995fedca075 (diff) | |
| download | python-cinderclient-246040a7325164eb0c7c3171dd21ceb7c7d149ce.tar.gz | |
Drop support for --sort_key and --sort_dir
These arguments were deprecated in the kilo release in favor of a
combined --sort argument. This drops support for the deprecated
arguments.
Change-Id: If8f8ac44cc81f553009a15ca67257e86cb925b6f
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
Diffstat (limited to 'cinderclient/base.py')
| -rw-r--r-- | cinderclient/base.py | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/cinderclient/base.py b/cinderclient/base.py index e84eb2f..a317ad4 100644 --- a/cinderclient/base.py +++ b/cinderclient/base.py @@ -131,8 +131,7 @@ class Manager(common_base.HookableMixin): return common_base.ListWithMeta(items, resp) def _build_list_url(self, resource_type, detailed=True, search_opts=None, - marker=None, limit=None, sort_key=None, sort_dir=None, - sort=None, offset=None): + marker=None, limit=None, sort=None, offset=None): if search_opts is None: search_opts = {} @@ -151,16 +150,6 @@ class Manager(common_base.HookableMixin): if sort: query_params['sort'] = self._format_sort_param(sort, resource_type) - else: - # sort_key and sort_dir deprecated in kilo, prefer sort - if sort_key: - query_params['sort_key'] = self._format_sort_key_param( - sort_key, - resource_type) - - if sort_dir: - query_params['sort_dir'] = self._format_sort_dir_param( - sort_dir) if offset: query_params['offset'] = offset @@ -179,7 +168,7 @@ class Manager(common_base.HookableMixin): "query_string": query_string}) def _format_sort_param(self, sort, resource_type=None): - '''Formats the sort information into the sort query string parameter. + """Formats the sort information into the sort query string parameter. The input sort information can be any of the following: - Comma-separated string in the form of <key[:dir]> @@ -195,7 +184,7 @@ class Manager(common_base.HookableMixin): :returns: Formatted query string parameter or None :raise ValueError: If an invalid sort direction or invalid sort key is given - ''' + """ if not sort: return None @@ -205,11 +194,7 @@ class Manager(common_base.HookableMixin): sort_array = [] for sort_item in sort: - if isinstance(sort_item, tuple): - sort_key = sort_item[0] - sort_dir = sort_item[1] - else: - sort_key, _sep, sort_dir = sort_item.partition(':') + sort_key, _sep, sort_dir = sort_item.partition(':') sort_key = sort_key.strip() sort_key = self._format_sort_key_param(sort_key, resource_type) if sort_dir: @@ -237,14 +222,6 @@ class Manager(common_base.HookableMixin): ', '.join(valid_sort_keys)) raise ValueError(msg) - def _format_sort_dir_param(self, sort_dir): - if sort_dir in SORT_DIR_VALUES: - return sort_dir - - msg = ('sort_dir must be one of the following: %s.' - % ', '.join(SORT_DIR_VALUES)) - raise ValueError(msg) - @contextlib.contextmanager def completion_cache(self, cache_type, obj_class, mode): """ |
