diff options
| author | Brian Waldon <brian.waldon@rackspace.com> | 2011-03-29 10:40:35 -0400 |
|---|---|---|
| committer | Brian Waldon <brian.waldon@rackspace.com> | 2011-03-29 10:40:35 -0400 |
| commit | 793de5cef9fb539a4fb3ba976d83adde38a589c1 (patch) | |
| tree | 935fb207d4449401e04d3790e54e6b1101c93d0b /nova/api | |
| parent | f460d75ae355ee76b6c51d884162f00076140716 (diff) | |
adding more tests; making name checks more robust
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/servers.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index e9bc0a797..29c491716 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -250,8 +250,15 @@ class Controller(wsgi.Controller): if 'name' in inst_dict['server']: name = inst_dict['server']['name'] - if not isinstance(name, basestring) or name == '': - return exc.HTTPBadRequest() + if not isinstance(name, basestring): + msg = _("Server name is not a string or unicode") + return exc.HTTPBadRequest(msg) + + name = name.strip() + + if name == '': + msg = _("Server name is an empty string") + return exc.HTTPBadRequest(msg) update_dict['display_name'] = name |
