Fixed DescribeUser in the ec2 admin client to return None instead of an empty UserInfo object.

This commit is contained in:
Devin Carlen
2011-03-28 18:45:56 +00:00
committed by Tarmac

View File

@@ -324,14 +324,11 @@ class NovaAdminClient(object):
def get_user(self, name):
"""Grab a single user by name."""
try:
return self.apiconn.get_object('DescribeUser',
{'Name': name},
UserInfo)
except boto.exception.BotoServerError, e:
if e.status == 400 and e.error_code == 'NotFound':
return None
raise
user = self.apiconn.get_object('DescribeUser',
{'Name': name},
UserInfo)
if user.username != None:
return user
def has_user(self, username):
"""Determine if user exists."""