Merge lp:~devcamcar/django-nova/fix_get_user into lp:django-nova

Proposed by Devin Carlen
Status: Merged
Approved by: Devin Carlen
Approved revision: 12
Merged at revision: 12
Proposed branch: lp:~devcamcar/django-nova/fix_get_user
Merge into: lp:django-nova
Diff against target: 28 lines (+7/-4)
1 file modified
src/django_nova/adminclient.py (+7/-4)
To merge this branch: bzr merge lp:~devcamcar/django-nova/fix_get_user
Reviewer Review Type Date Requested Status
Devin Carlen Approve
Review via email: mp+47861@code.launchpad.net

Description of the change

Made adminclient get_user return None instead of throwing EC2Exception if requested user not available

To post a comment you must log in.
Revision history for this message
Devin Carlen (devcamcar) wrote :

approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/django_nova/adminclient.py'
--- src/django_nova/adminclient.py 2011-01-12 20:02:06 +0000
+++ src/django_nova/adminclient.py 2011-01-28 20:44:57 +0000
@@ -21,6 +21,7 @@
2121
22import base6422import base64
23import boto23import boto
24import boto.exception
24import httplib25import httplib
25import re26import re
26import string27import string
@@ -332,10 +333,12 @@
332333
333 def get_user(self, name):334 def get_user(self, name):
334 """ grab a single user by name """335 """ grab a single user by name """
335 user = self.apiconn.get_object('DescribeUser', {'Name': name}, UserInfo)336 try:
336337 return self.apiconn.get_object('DescribeUser', {'Name': name}, UserInfo)
337 if user.username != None:338 except boto.exception.BotoServerError, e:
338 return user339 if e.status == 400 and e.error_code == 'NotFound':
340 return None
341 raise
339342
340 def has_user(self, username):343 def has_user(self, username):
341 """ determine if user exists """344 """ determine if user exists """

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: