diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-04-27 20:48:27 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-04-27 20:48:27 +0000 |
| commit | f8343bb3c2592404197c0d56fc987fd8b779a307 (patch) | |
| tree | 9afc341fcb3f925b2addb73d712b1390831c79e6 | |
| parent | cd57400a21cabb3c10bb02184145fe4704859be2 (diff) | |
| parent | 090bef6ce12ba83706dd328e697d4794c23f2572 (diff) | |
Merge "Do not allow blank adminPass attribute on set password"
| -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 251ab769f..3715f2593 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 |
