Fix the link to get the next share replica
The url to get the next share replica is broken when performing pagination. The new API uses underscore to represent resource. This fix resolves the broken link for share replicas by using alias. Closes-bug: #2023754 Change-Id: I31e32c0bcfb60b53121da9a96df3b44ad2b3ac67
This commit is contained in:
parent
a5532c3080
commit
c8236141f8
@ -302,6 +302,7 @@ class ViewBuilder(object):
|
|||||||
"""Model API responses as dictionaries."""
|
"""Model API responses as dictionaries."""
|
||||||
|
|
||||||
_collection_name = None
|
_collection_name = None
|
||||||
|
_collection_route_name = None
|
||||||
_detail_version_modifiers = []
|
_detail_version_modifiers = []
|
||||||
|
|
||||||
def _get_project_id(self, request):
|
def _get_project_id(self, request):
|
||||||
@ -325,20 +326,30 @@ class ViewBuilder(object):
|
|||||||
"""Return href string with proper limit and marker params."""
|
"""Return href string with proper limit and marker params."""
|
||||||
params = request.params.copy()
|
params = request.params.copy()
|
||||||
params["marker"] = identifier
|
params["marker"] = identifier
|
||||||
|
url = ""
|
||||||
|
collection_route_name = (
|
||||||
|
self._collection_route_name
|
||||||
|
or self._collection_name
|
||||||
|
)
|
||||||
prefix = self._update_link_prefix(request.application_url,
|
prefix = self._update_link_prefix(request.application_url,
|
||||||
CONF.osapi_share_base_URL)
|
CONF.osapi_share_base_URL)
|
||||||
url = os.path.join(prefix,
|
url = os.path.join(prefix,
|
||||||
self._get_project_id(request),
|
self._get_project_id(request),
|
||||||
self._collection_name)
|
collection_route_name)
|
||||||
|
|
||||||
return "%s?%s" % (url, dict_to_query_str(params))
|
return "%s?%s" % (url, dict_to_query_str(params))
|
||||||
|
|
||||||
def _get_href_link(self, request, identifier):
|
def _get_href_link(self, request, identifier):
|
||||||
"""Return an href string pointing to this object."""
|
"""Return an href string pointing to this object."""
|
||||||
|
collection_route_name = (
|
||||||
|
self._collection_route_name
|
||||||
|
or self._collection_name
|
||||||
|
)
|
||||||
prefix = self._update_link_prefix(request.application_url,
|
prefix = self._update_link_prefix(request.application_url,
|
||||||
CONF.osapi_share_base_URL)
|
CONF.osapi_share_base_URL)
|
||||||
return os.path.join(prefix,
|
return os.path.join(prefix,
|
||||||
self._get_project_id(request),
|
self._get_project_id(request),
|
||||||
self._collection_name,
|
collection_route_name,
|
||||||
str(identifier))
|
str(identifier))
|
||||||
|
|
||||||
def _get_bookmark_link(self, request, identifier):
|
def _get_bookmark_link(self, request, identifier):
|
||||||
@ -346,9 +357,13 @@ class ViewBuilder(object):
|
|||||||
base_url = remove_version_from_href(request.application_url)
|
base_url = remove_version_from_href(request.application_url)
|
||||||
base_url = self._update_link_prefix(base_url,
|
base_url = self._update_link_prefix(base_url,
|
||||||
CONF.osapi_share_base_URL)
|
CONF.osapi_share_base_URL)
|
||||||
|
collection_route_name = (
|
||||||
|
self._collection_route_name
|
||||||
|
or self._collection_name
|
||||||
|
)
|
||||||
return os.path.join(base_url,
|
return os.path.join(base_url,
|
||||||
self._get_project_id(request),
|
self._get_project_id(request),
|
||||||
self._collection_name,
|
collection_route_name,
|
||||||
str(identifier))
|
str(identifier))
|
||||||
|
|
||||||
def _get_collection_links(self, request, items, id_key="uuid"):
|
def _get_collection_links(self, request, items, id_key="uuid"):
|
||||||
|
@ -20,6 +20,7 @@ class ReplicationViewBuilder(common.ViewBuilder):
|
|||||||
"""Model a server API response as a python dictionary."""
|
"""Model a server API response as a python dictionary."""
|
||||||
|
|
||||||
_collection_name = 'share_replicas'
|
_collection_name = 'share_replicas'
|
||||||
|
_collection_route_name = "share-replicas"
|
||||||
_collection_links = 'share_replica_links'
|
_collection_links = 'share_replica_links'
|
||||||
|
|
||||||
_detail_version_modifiers = [
|
_detail_version_modifiers = [
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Launchpad `bug 2023754 <https://bugs.launchpad.net/manila/+bug/2023754>`_
|
||||||
|
has been fixed for "next links" broken for limited share replicas api.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user