diff options
| author | Ewan Mellor <ewan.mellor@citrix.com> | 2011-11-27 23:26:49 -0800 |
|---|---|---|
| committer | Ewan Mellor <ewan.mellor@citrix.com> | 2011-11-27 23:37:06 -0800 |
| commit | 4a76167e354eed4aa98232fbf6c845f86ce4cf22 (patch) | |
| tree | 5fb0eb2aaf5731d48e7578ea9c30539c63450f7f /nova/api | |
| parent | 356ec713068b82af3cf449815ae76d82b4f86242 (diff) | |
| download | nova-4a76167e354eed4aa98232fbf6c845f86ce4cf22.tar.gz nova-4a76167e354eed4aa98232fbf6c845f86ce4cf22.tar.xz nova-4a76167e354eed4aa98232fbf6c845f86ce4cf22.zip | |
Bug #897091: "nova actions" fails with HTTP 400 / TypeError if a server action has been performed
Fix code in Controller.action that was overwriting the definition of the
actions method with a dictionary. This meant that 'nova actions' would fail
if 'nova reboot' had previously been called.
Added two tests, one for the actions call in general, and one for this
failure mode specifically.
Change-Id: I695bb5c4dcfba96a5aba54125a8f3163e1a6a193
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/v2/servers.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/nova/api/openstack/v2/servers.py b/nova/api/openstack/v2/servers.py index 144566d33..5066633be 100644 --- a/nova/api/openstack/v2/servers.py +++ b/nova/api/openstack/v2/servers.py @@ -506,7 +506,7 @@ class Controller(wsgi.Controller): @scheduler_api.redirect_handler def action(self, req, id, body): """Multi-purpose method used to take actions on a server""" - self.actions = { + _actions = { 'changePassword': self._action_change_password, 'reboot': self._action_reboot, 'resize': self._action_resize, @@ -520,11 +520,11 @@ class Controller(wsgi.Controller): admin_actions = { 'createBackup': self._action_create_backup, } - self.actions.update(admin_actions) + _actions.update(admin_actions) for key in body: - if key in self.actions: - return self.actions[key](body, req, id) + if key in _actions: + return _actions[key](body, req, id) else: msg = _("There is no such server action: %s") % (key,) raise exc.HTTPBadRequest(explanation=msg) |
