From 090bef6ce12ba83706dd328e697d4794c23f2572 Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Wed, 18 Apr 2012 18:22:16 -0400 Subject: Do not allow blank adminPass attribute on set password Fixes bug 985263 Change-Id: I846248a4b8cb22fcaca9e51cc477813f80f6d602 --- nova/api/openstack/compute/servers.py | 2 +- nova/tests/api/openstack/compute/test_server_actions.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) 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 = """ + """ + self.assertRaises(AttributeError, + self.deserializer.deserialize, + serial_request, + 'action') + def test_reboot(self): serial_request = """