From d8bd2392b225babf7a39ef16c82e79016db04a36 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 6 Mar 2020 16:52:14 +0000 Subject: [PATCH] Fix os-keypairs pagination links The API URL is '/os-keypairs', not '/keypairs'. Attempting to use these pagination links as-is will result in a HTTP 404 (Not Found). Change-Id: Ic04568caecc138e6016418f6878d031c4a0d3fb4 Signed-off-by: Stephen Finucane Closes-bug: #1866373 (cherry picked from commit f31efe0a0e3f194ca415ac41c225f63dbb69267b) (cherry picked from commit 93f903d7949194a3e00647d8a17b2d3bee3904e5) (cherry picked from commit 85052c055fb062f4a2ca7bb833f1cb344073b6de) --- doc/api_samples/keypairs/v2.35/keypairs-list-resp.json | 4 ++-- doc/api_samples/keypairs/v2.35/keypairs-list-user2-resp.json | 4 ++-- nova/api/openstack/compute/views/keypairs.py | 2 +- .../api_samples/keypairs/v2.35/keypairs-list-resp.json.tpl | 2 +- .../keypairs/v2.35/keypairs-list-user2-resp.json.tpl | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/api_samples/keypairs/v2.35/keypairs-list-resp.json b/doc/api_samples/keypairs/v2.35/keypairs-list-resp.json index 69c8ec4f143c..786a0b6ce2f1 100644 --- a/doc/api_samples/keypairs/v2.35/keypairs-list-resp.json +++ b/doc/api_samples/keypairs/v2.35/keypairs-list-resp.json @@ -11,8 +11,8 @@ ], "keypairs_links": [ { - "href": "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/keypairs?limit=1&marker=keypair-5d935425-31d5-48a7-a0f1-e76e9813f2c3", + "href": "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/os-keypairs?limit=1&marker=keypair-5d935425-31d5-48a7-a0f1-e76e9813f2c3", "rel": "next" } ] -} \ No newline at end of file +} diff --git a/doc/api_samples/keypairs/v2.35/keypairs-list-user2-resp.json b/doc/api_samples/keypairs/v2.35/keypairs-list-user2-resp.json index 3c75f9ef6210..e9a5e9318b61 100644 --- a/doc/api_samples/keypairs/v2.35/keypairs-list-user2-resp.json +++ b/doc/api_samples/keypairs/v2.35/keypairs-list-user2-resp.json @@ -11,8 +11,8 @@ ], "keypairs_links": [ { - "href": "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/keypairs?limit=1&marker=keypair-5d935425-31d5-48a7-a0f1-e76e9813f2c3&user_id=user2", + "href": "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/os-keypairs?limit=1&marker=keypair-5d935425-31d5-48a7-a0f1-e76e9813f2c3&user_id=user2", "rel": "next" } ] -} \ No newline at end of file +} diff --git a/nova/api/openstack/compute/views/keypairs.py b/nova/api/openstack/compute/views/keypairs.py index 020c7a0ac865..dd722fd33df2 100644 --- a/nova/api/openstack/compute/views/keypairs.py +++ b/nova/api/openstack/compute/views/keypairs.py @@ -18,7 +18,7 @@ from nova.api.openstack import common class ViewBuilder(common.ViewBuilder): - _collection_name = "keypairs" + _collection_name = 'os-keypairs' def get_links(self, request, keypairs): return self._get_collection_links(request, keypairs, diff --git a/nova/tests/functional/api_sample_tests/api_samples/keypairs/v2.35/keypairs-list-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/keypairs/v2.35/keypairs-list-resp.json.tpl index 0b2bf63e7f5b..2fb1ba24236f 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/keypairs/v2.35/keypairs-list-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/keypairs/v2.35/keypairs-list-resp.json.tpl @@ -11,7 +11,7 @@ ], "keypairs_links": [ { - "href": "%(versioned_compute_endpoint)s/keypairs?limit=1&marker=%(keypair_name)s", + "href": "%(versioned_compute_endpoint)s/os-keypairs?limit=1&marker=%(keypair_name)s", "rel": "next" } ] diff --git a/nova/tests/functional/api_sample_tests/api_samples/keypairs/v2.35/keypairs-list-user2-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/keypairs/v2.35/keypairs-list-user2-resp.json.tpl index 2252e53551b1..8a00094c3fea 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/keypairs/v2.35/keypairs-list-user2-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/keypairs/v2.35/keypairs-list-user2-resp.json.tpl @@ -11,7 +11,7 @@ ], "keypairs_links": [ { - "href": "%(versioned_compute_endpoint)s/keypairs?limit=1&marker=%(keypair_name)s&user_id=user2", + "href": "%(versioned_compute_endpoint)s/os-keypairs?limit=1&marker=%(keypair_name)s&user_id=user2", "rel": "next" } ]