diff options
| author | Alex Meade <alex.meade@rackspace.com> | 2012-04-18 18:22:16 -0400 |
|---|---|---|
| committer | Alex Meade <alex.meade@rackspace.com> | 2012-04-18 18:22:16 -0400 |
| commit | 090bef6ce12ba83706dd328e697d4794c23f2572 (patch) | |
| tree | e2cc3f97ec8112911bc27c936a7a4db05573ef0e | |
| parent | ab7e5907ff0fdad759d5e00a351c757c1e5de452 (diff) | |
| download | nova-090bef6ce12ba83706dd328e697d4794c23f2572.tar.gz nova-090bef6ce12ba83706dd328e697d4794c23f2572.tar.xz nova-090bef6ce12ba83706dd328e697d4794c23f2572.zip | |
Do not allow blank adminPass attribute on set password
Fixes bug 985263
Change-Id: I846248a4b8cb22fcaca9e51cc477813f80f6d602
| -rw-r--r-- | nova/api/openstack/compute/servers.py | 2 | ||||
| -rw-r--r-- | nova/tests/api/openstack/compute/test_server_actions.py | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 2e7b184c4..dbdcf8112 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -259,7 +259,7 @@ class ActionDeserializer(CommonDeserializer): return self._deserialize_image_action(node, ('name',)) def _action_change_password(self, node): - if not node.hasAttribute("adminPass"): + if not node.getAttribute("adminPass"): raise AttributeError("No adminPass was specified in request") return {"adminPass": node.getAttribute("adminPass")} diff --git a/nova/tests/api/openstack/compute/test_server_actions.py b/nova/tests/api/openstack/compute/test_server_actions.py index fd9b5eaef..bcb318c69 100644 --- a/nova/tests/api/openstack/compute/test_server_actions.py +++ b/nova/tests/api/openstack/compute/test_server_actions.py @@ -758,6 +758,16 @@ class TestServerActionXMLDeserializer(test.TestCase): serial_request, 'action') + def test_change_pass_empty_pass(self): + serial_request = """<?xml version="1.0" encoding="UTF-8"?> + <changePassword + xmlns="http://docs.openstack.org/compute/api/v1.1" + adminPass=""/> """ + self.assertRaises(AttributeError, + self.deserializer.deserialize, + serial_request, + 'action') + def test_reboot(self): serial_request = """<?xml version="1.0" encoding="UTF-8"?> <reboot |
