From f31efe0a0e3f194ca415ac41c225f63dbb69267b 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 --- 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 69c8ec4f14..786a0b6ce2 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 3c75f9ef62..e9a5e9318b 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 2c9ba99c93..202be5ac31 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' # TODO(takashin): After v2 and v2.1 is no longer supported, # 'type' can always be included in the response. _index_params = ('name', 'public_key', 'fingerprint') 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 0b2bf63e7f..2fb1ba2423 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 2252e53551..8a00094c3f 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" } ]