Merge "Make rebuilds with an emtpy name raise BadRequest."
This commit is contained in:
commit
76bb37e049
@ -271,7 +271,10 @@ class ActionDeserializer(CommonDeserializer):
|
||||
def _action_rebuild(self, node):
|
||||
rebuild = {}
|
||||
if node.hasAttribute("name"):
|
||||
rebuild['name'] = node.getAttribute("name")
|
||||
name = node.getAttribute("name")
|
||||
if not name:
|
||||
raise AttributeError("Name cannot be blank")
|
||||
rebuild['name'] = name
|
||||
|
||||
if node.hasAttribute("auto_disk_config"):
|
||||
rebuild['auto_disk_config'] = node.getAttribute("auto_disk_config")
|
||||
|
@ -887,3 +887,14 @@ class TestServerActionXMLDeserializer(test.TestCase):
|
||||
self.deserializer.deserialize,
|
||||
serial_request,
|
||||
'action')
|
||||
|
||||
def test_rebuild_blank_name(self):
|
||||
serial_request = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rebuild
|
||||
xmlns="http://docs.openstack.org/compute/api/v1.1"
|
||||
imageRef="http://localhost/images/1"
|
||||
name=""/>"""
|
||||
self.assertRaises(AttributeError,
|
||||
self.deserializer.deserialize,
|
||||
serial_request,
|
||||
'action')
|
||||
|
Loading…
Reference in New Issue
Block a user