Merge "Error code for creating duplicate floating_ip_bulk"
This commit is contained in:
@@ -103,7 +103,7 @@ class FloatingIPBulkController(object):
|
|||||||
try:
|
try:
|
||||||
objects.FloatingIPList.create(context, ips)
|
objects.FloatingIPList.create(context, ips)
|
||||||
except exception.FloatingIpExists as exc:
|
except exception.FloatingIpExists as exc:
|
||||||
raise webob.exc.HTTPBadRequest(explanation=exc.format_message())
|
raise webob.exc.HTTPConflict(explanation=exc.format_message())
|
||||||
|
|
||||||
return {"floating_ips_bulk_create": {"ip_range": ip_range,
|
return {"floating_ips_bulk_create": {"ip_range": ip_range,
|
||||||
"pool": pool,
|
"pool": pool,
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class FloatingIPBulkController(wsgi.Controller):
|
|||||||
|
|
||||||
return floating_ip_info
|
return floating_ip_info
|
||||||
|
|
||||||
@extensions.expected_errors(400)
|
@extensions.expected_errors((400, 409))
|
||||||
@validation.schema(floating_ips_bulk.create)
|
@validation.schema(floating_ips_bulk.create)
|
||||||
def create(self, req, body):
|
def create(self, req, body):
|
||||||
"""Bulk create floating ips."""
|
"""Bulk create floating ips."""
|
||||||
@@ -106,7 +106,7 @@ class FloatingIPBulkController(wsgi.Controller):
|
|||||||
try:
|
try:
|
||||||
objects.FloatingIPList.create(context, ips)
|
objects.FloatingIPList.create(context, ips)
|
||||||
except exception.FloatingIpExists as exc:
|
except exception.FloatingIpExists as exc:
|
||||||
raise webob.exc.HTTPBadRequest(explanation=exc.format_message())
|
raise webob.exc.HTTPConflict(explanation=exc.format_message())
|
||||||
|
|
||||||
return {"floating_ips_bulk_create": {"ip_range": ip_range,
|
return {"floating_ips_bulk_create": {"ip_range": ip_range,
|
||||||
"pool": pool,
|
"pool": pool,
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ class FloatingIPBulkV21(test.TestCase):
|
|||||||
ip_range = '192.168.1.0/29'
|
ip_range = '192.168.1.0/29'
|
||||||
body = {'floating_ips_bulk_create': {'ip_range': ip_range}}
|
body = {'floating_ips_bulk_create': {'ip_range': ip_range}}
|
||||||
req = fakes.HTTPRequest.blank(self.url)
|
req = fakes.HTTPRequest.blank(self.url)
|
||||||
self.assertRaises(webob.exc.HTTPBadRequest, self.controller.create,
|
self.assertRaises(webob.exc.HTTPConflict, self.controller.create,
|
||||||
req, body=body)
|
req, body=body)
|
||||||
|
|
||||||
def test_create_bad_cidr_fail(self):
|
def test_create_bad_cidr_fail(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user