diff options
| author | Devin Carlen <devin.carlen@gmail.com> | 2011-01-30 23:54:16 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-01-30 23:54:16 +0000 |
| commit | 8fbfae5065c07a4c0258585ab19c838fc87b0913 (patch) | |
| tree | 17a186ec5b3d04abba3e12eb1918d78cf6d19ce6 /nova | |
| parent | 396b02f876030f1f54b7af32cf94fccbbe1fe46b (diff) | |
| parent | 6ed93f6116ed092e64ceef9a255b46167099bfc3 (diff) | |
| download | nova-8fbfae5065c07a4c0258585ab19c838fc87b0913.tar.gz nova-8fbfae5065c07a4c0258585ab19c838fc87b0913.tar.xz nova-8fbfae5065c07a4c0258585ab19c838fc87b0913.zip | |
Made adminclient get_user return None instead of throwing EC2Exception if requested user not available.
This change is isolated to the adminclient code itself and has no ramifications on the nova server codebase.
This bug severely impacts automated deployments of django-nova and the openstack-dashboard, which are scheduled for formal release next week, so I'd really like to see this simple patch make it in for bexar release.
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/adminclient.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/nova/adminclient.py b/nova/adminclient.py index 3cdd8347f..4106f0f47 100644 --- a/nova/adminclient.py +++ b/nova/adminclient.py @@ -21,6 +21,7 @@ Nova User API client library. import base64 import boto +import boto.exception import httplib from boto.ec2.regioninfo import RegionInfo @@ -288,10 +289,14 @@ class NovaAdminClient(object): def get_user(self, name): """Grab a single user by name.""" - user = self.apiconn.get_object('DescribeUser', {'Name': name}, - UserInfo) - if user.username != None: - return user + 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 def has_user(self, username): """Determine if user exists.""" |
