diff --git a/zaqar/api/v1/response.py b/zaqar/api/v1/response.py index 135855ccf..f8a9d2a08 100644 --- a/zaqar/api/v1/response.py +++ b/zaqar/api/v1/response.py @@ -178,6 +178,9 @@ class ResponseSchema(api.Api): 'type': 'number', 'minimum': -1 }, + 'name': { + 'type': 'string' + }, 'uri': { 'type': 'string' }, diff --git a/zaqar/api/v1_1/response.py b/zaqar/api/v1_1/response.py index 7ee5029f0..d146ed34b 100644 --- a/zaqar/api/v1_1/response.py +++ b/zaqar/api/v1_1/response.py @@ -219,6 +219,9 @@ class ResponseSchema(api.Api): 'type': 'number', 'minimum': -1 }, + 'name': { + 'type': 'string' + }, 'uri': { 'type': 'string' }, @@ -271,6 +274,9 @@ class ResponseSchema(api.Api): 'pool_detail': { 'type': 'object', 'properties': { + 'name': { + 'type': 'string' + }, 'uri': { 'type': 'string' }, diff --git a/zaqar/tests/unit/transport/wsgi/v1/test_pools.py b/zaqar/tests/unit/transport/wsgi/v1/test_pools.py index ae8839119..749028682 100644 --- a/zaqar/tests/unit/transport/wsgi/v1/test_pools.py +++ b/zaqar/tests/unit/transport/wsgi/v1/test_pools.py @@ -158,6 +158,7 @@ class PoolsBaseTest(base.V1Base): def _pool_expect(self, pool, xhref, xweight, xuri): self.assertIn('href', pool) + self.assertIn('name', pool) self.assertEqual(pool['href'], xhref) self.assertIn('weight', pool) self.assertEqual(pool['weight'], xweight) diff --git a/zaqar/tests/unit/transport/wsgi/v1_1/test_flavors.py b/zaqar/tests/unit/transport/wsgi/v1_1/test_flavors.py index e612bf33a..a63eff501 100644 --- a/zaqar/tests/unit/transport/wsgi/v1_1/test_flavors.py +++ b/zaqar/tests/unit/transport/wsgi/v1_1/test_flavors.py @@ -174,6 +174,7 @@ class TestFlavorsMongoDB(base.V1_1Base): def _flavor_expect(self, flavor, xhref, xpool): self.assertIn('href', flavor) + self.assertIn('name', flavor) self.assertEqual(flavor['href'], xhref) self.assertIn('pool', flavor) self.assertEqual(flavor['pool'], xpool) diff --git a/zaqar/tests/unit/transport/wsgi/v1_1/test_pools.py b/zaqar/tests/unit/transport/wsgi/v1_1/test_pools.py index 03606af96..6d637ae94 100644 --- a/zaqar/tests/unit/transport/wsgi/v1_1/test_pools.py +++ b/zaqar/tests/unit/transport/wsgi/v1_1/test_pools.py @@ -166,6 +166,7 @@ class TestPoolsMongoDB(base.V1_1Base): def _pool_expect(self, pool, xhref, xweight, xuri): self.assertIn('href', pool) + self.assertIn('name', pool) self.assertEqual(pool['href'], xhref) self.assertIn('weight', pool) self.assertEqual(pool['weight'], xweight) diff --git a/zaqar/tests/unit/transport/wsgi/v2_0/test_flavors.py b/zaqar/tests/unit/transport/wsgi/v2_0/test_flavors.py index 66257750a..f1cd98e5e 100644 --- a/zaqar/tests/unit/transport/wsgi/v2_0/test_flavors.py +++ b/zaqar/tests/unit/transport/wsgi/v2_0/test_flavors.py @@ -174,6 +174,7 @@ class TestFlavorsMongoDB(base.V2Base): def _flavor_expect(self, flavor, xhref, xpool): self.assertIn('href', flavor) + self.assertIn('name', flavor) self.assertEqual(flavor['href'], xhref) self.assertIn('pool', flavor) self.assertEqual(flavor['pool'], xpool) diff --git a/zaqar/tests/unit/transport/wsgi/v2_0/test_pools.py b/zaqar/tests/unit/transport/wsgi/v2_0/test_pools.py index 0a95eb727..fc4478231 100644 --- a/zaqar/tests/unit/transport/wsgi/v2_0/test_pools.py +++ b/zaqar/tests/unit/transport/wsgi/v2_0/test_pools.py @@ -165,6 +165,7 @@ class TestPoolsMongoDB(base.V2Base): def _pool_expect(self, pool, xhref, xweight, xuri): self.assertIn('href', pool) + self.assertIn('name', pool) self.assertEqual(pool['href'], xhref) self.assertIn('weight', pool) self.assertEqual(pool['weight'], xweight) diff --git a/zaqar/transport/wsgi/v1_0/pools.py b/zaqar/transport/wsgi/v1_0/pools.py index 9e986c816..d97f0eb52 100644 --- a/zaqar/transport/wsgi/v1_0/pools.py +++ b/zaqar/transport/wsgi/v1_0/pools.py @@ -94,7 +94,7 @@ class Listing(object): store['marker'] = next(cursor) for entry in pools: - entry['href'] = request.path + '/' + entry.pop('name') + entry['href'] = request.path + '/' + entry['name'] results['links'] = [ { @@ -147,8 +147,6 @@ class Resource(object): data['href'] = request.path - # remove the name entry - it isn't needed on GET - del data['name'] response.body = transport_utils.to_json(data) response.content_location = request.relative_uri diff --git a/zaqar/transport/wsgi/v1_1/flavors.py b/zaqar/transport/wsgi/v1_1/flavors.py index 2a543edd1..dd7ee8adf 100644 --- a/zaqar/transport/wsgi/v1_1/flavors.py +++ b/zaqar/transport/wsgi/v1_1/flavors.py @@ -72,7 +72,7 @@ class Listing(object): store['marker'] = next(cursor) for entry in flavors: - entry['href'] = request.path + '/' + entry.pop('name') + entry['href'] = request.path + '/' + entry['name'] results['links'] = [ { @@ -126,8 +126,6 @@ class Resource(object): data['href'] = request.path - # remove the name entry - it isn't needed on GET - del data['name'] response.body = transport_utils.to_json(data) def on_put(self, request, response, project_id, flavor): diff --git a/zaqar/transport/wsgi/v1_1/pools.py b/zaqar/transport/wsgi/v1_1/pools.py index 2cdcda840..b21cb83f3 100644 --- a/zaqar/transport/wsgi/v1_1/pools.py +++ b/zaqar/transport/wsgi/v1_1/pools.py @@ -95,7 +95,7 @@ class Listing(object): store['marker'] = next(cursor) for entry in pools: - entry['href'] = request.path + '/' + entry.pop('name') + entry['href'] = request.path + '/' + entry['name'] results['links'] = [ { @@ -150,8 +150,6 @@ class Resource(object): data['href'] = request.path - # remove the name entry - it isn't needed on GET - del data['name'] response.body = transport_utils.to_json(data) def on_put(self, request, response, project_id, pool): diff --git a/zaqar/transport/wsgi/v2_0/flavors.py b/zaqar/transport/wsgi/v2_0/flavors.py index bc9ccc841..51ecd3a03 100644 --- a/zaqar/transport/wsgi/v2_0/flavors.py +++ b/zaqar/transport/wsgi/v2_0/flavors.py @@ -73,7 +73,7 @@ class Listing(object): store['marker'] = next(cursor) for entry in flavors: - entry['href'] = request.path + '/' + entry.pop('name') + entry['href'] = request.path + '/' + entry['name'] if detailed: caps = self._pools_ctrl.capabilities(group=entry['pool']) entry['capabilities'] = [str(cap).split('.')[-1] @@ -136,8 +136,6 @@ class Resource(object): data['href'] = request.path - # remove the name entry - it isn't needed on GET - del data['name'] response.body = transport_utils.to_json(data) def on_put(self, request, response, project_id, flavor): diff --git a/zaqar/transport/wsgi/v2_0/pools.py b/zaqar/transport/wsgi/v2_0/pools.py index 2cdcda840..b21cb83f3 100644 --- a/zaqar/transport/wsgi/v2_0/pools.py +++ b/zaqar/transport/wsgi/v2_0/pools.py @@ -95,7 +95,7 @@ class Listing(object): store['marker'] = next(cursor) for entry in pools: - entry['href'] = request.path + '/' + entry.pop('name') + entry['href'] = request.path + '/' + entry['name'] results['links'] = [ { @@ -150,8 +150,6 @@ class Resource(object): data['href'] = request.path - # remove the name entry - it isn't needed on GET - del data['name'] response.body = transport_utils.to_json(data) def on_put(self, request, response, project_id, pool):