Prevents PUT on ip_addresses with empty port list

JIRA:NCP-1631
This commit is contained in:
Justin Hammond
2015-10-13 14:05:57 -05:00
parent e15a093b97
commit 6ea681d5b3
3 changed files with 28 additions and 30 deletions

View File

@@ -281,7 +281,13 @@ def update_ip_address(context, id, ip_address):
msg = "Modification of reset_allocation_time requires admin"
raise webob.exc.HTTPForbidden(detail=msg)
port_ids = ip_address['ip_address'].get('port_ids')
port_ids = ip_address['ip_address'].get('port_ids', None)
if port_ids is not None and not port_ids:
raise exceptions.BadRequest(
resource="ip_addresses",
msg="Cannot be updated with empty port_id list")
if iptype == ip_types.SHARED:
has_owner = address.has_any_shared_owner()