summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJustin Santa Barbara <justin@fathomdb.com>2011-03-16 12:15:57 -0700
committerJustin Santa Barbara <justin@fathomdb.com>2011-03-16 12:15:57 -0700
commit7de1ef791296d547c2691454d5cb5451087cd76b (patch)
tree4495ebef4db68eb878058116ae5e75d6d5abfaea /nova/api
parent20031162372329b40ca90b1bc39cebb4f187cace (diff)
User ids are strings, and are not necessarily == name. Also fix so that non-existent user gives a 404, not a 500.
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/users.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/nova/api/openstack/users.py b/nova/api/openstack/users.py
index ebd0f4512..d3ab3d553 100644
--- a/nova/api/openstack/users.py
+++ b/nova/api/openstack/users.py
@@ -13,13 +13,14 @@
# License for the specific language governing permissions and limitations
# under the License.
-import common
+from webob import exc
from nova import exception
from nova import flags
from nova import log as logging
from nova import wsgi
-
+from nova.api.openstack import common
+from nova.api.openstack import faults
from nova.auth import manager
FLAGS = flags.FLAGS
@@ -63,7 +64,17 @@ class Controller(wsgi.Controller):
def show(self, req, id):
"""Return data about the given user id"""
- user = self.manager.get_user(id)
+
+ #NOTE(justinsb): The drivers are a little inconsistent in how they
+ # deal with "NotFound" - some throw, some return None.
+ try:
+ user = self.manager.get_user(id)
+ except exception.NotFound:
+ user = None
+
+ if user is None:
+ raise faults.Fault(exc.HTTPNotFound())
+
return dict(user=_translate_keys(user))
def delete(self, req, id):