Skip to content

Commit

Permalink
Do not allow blank adminPass attribute on set password
Browse files Browse the repository at this point in the history
Fixes bug 985263

Change-Id: I846248a4b8cb22fcaca9e51cc477813f80f6d602
  • Loading branch information
ameade committed Apr 18, 2012
1 parent ab7e590 commit 090bef6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def _action_create_image(self, node):
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")}

Expand Down
10 changes: 10 additions & 0 deletions nova/tests/api/openstack/compute/test_server_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,16 @@ def test_change_pass_no_pass(self):
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
Expand Down

0 comments on commit 090bef6

Please sign in to comment.