diff options
| author | Michael Gundlach <michael.gundlach@rackspace.com> | 2010-12-02 13:29:37 -0600 |
|---|---|---|
| committer | Michael Gundlach <michael.gundlach@rackspace.com> | 2010-12-02 13:29:37 -0600 |
| commit | 7bcbc2a6e1b907886e03e5254dcd0a726ccdcd9d (patch) | |
| tree | 0ced83605d7dcadeb677f38fdbaa23ebbb4cc71a /nova/api | |
| parent | 9d5e1b52f837047aac55d08a664a35be7cc5b8ef (diff) | |
| download | nova-7bcbc2a6e1b907886e03e5254dcd0a726ccdcd9d.tar.gz nova-7bcbc2a6e1b907886e03e5254dcd0a726ccdcd9d.tar.xz nova-7bcbc2a6e1b907886e03e5254dcd0a726ccdcd9d.zip | |
Oops, update 'display_name', not 'name'. And un-extract-method.
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/__init__.py | 2 | ||||
| -rw-r--r-- | nova/api/openstack/servers.py | 20 |
2 files changed, 9 insertions, 13 deletions
diff --git a/nova/api/openstack/__init__.py b/nova/api/openstack/__init__.py index 1dd3ba770..4ca108c4e 100644 --- a/nova/api/openstack/__init__.py +++ b/nova/api/openstack/__init__.py @@ -25,6 +25,7 @@ import time import logging import routes +import traceback import webob.dec import webob.exc import webob @@ -61,6 +62,7 @@ class API(wsgi.Middleware): return req.get_response(self.application) except Exception as ex: logging.warn("Caught error: %s" % str(ex)) + logging.debug(traceback.format_exc()) exc = webob.exc.HTTPInternalServerError(explanation=str(ex)) return faults.Fault(exc) diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index f85aabbfa..a2a637def 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -34,16 +34,6 @@ import nova.image.service FLAGS = flags.FLAGS -def _filter_params(inst_dict): - """ Extracts all updatable parameters for a server update request """ - keys = dict(name='name', admin_pass='adminPass') - new_attrs = {} - for k, v in keys.items(): - if v in inst_dict: - new_attrs[k] = inst_dict[v] - return new_attrs - - def _entity_list(entities): """ Coerces a list of servers into proper dictionary format """ return dict(servers=entities) @@ -171,9 +161,13 @@ class Controller(wsgi.Controller): if not instance or instance.user_id != user_id: return faults.Fault(exc.HTTPNotFound()) - self.db_driver.instance_update(ctxt, - int(id), - _filter_params(inst_dict['server'])) + update_dict = {} + if 'adminPass' in inst_dict['server']: + update_dict['admin_pass'] = inst_dict['server']['adminPass'] + if 'name' in inst_dict['server']: + update_dict['display_name'] = inst_dict['server']['name'] + + self.db_driver.instance_update(ctxt, instance['id'], update_dict) return exc.HTTPNoContent() def action(self, req, id): |
