diff options
| author | Brian Waldon <bcwaldon@gmail.com> | 2012-06-27 08:29:40 -0700 |
|---|---|---|
| committer | Brian Waldon <bcwaldon@gmail.com> | 2012-06-27 14:35:10 -0700 |
| commit | 0ca1c1943e6a07e7a107f38f56227768022de3dc (patch) | |
| tree | 72c98e945c1a00c902aba39a3799347585427cb8 /nova/api | |
| parent | 3aaa0b103447d56f8d3b259c693cd9a3a8dcbe36 (diff) | |
| download | nova-0ca1c1943e6a07e7a107f38f56227768022de3dc.tar.gz nova-0ca1c1943e6a07e7a107f38f56227768022de3dc.tar.xz nova-0ca1c1943e6a07e7a107f38f56227768022de3dc.zip | |
Remove image service show_by_name method
This method isn't worth keeping around. It's used in one place and
consists of a try/except block. We also shouldn't encourage clients
of GlanceImageService to depend on finding a single unique image
by a non-unique attribute.
Change-Id: I02347adef7bc7ac70407226ea150000e55a798bc
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/cloud.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 68f3b5b3d..75f28d510 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -1245,9 +1245,11 @@ class CloudController(object): internal_id = ec2utils.ec2_id_to_id(ec2_id) image = self.image_service.show(context, internal_id) except (exception.InvalidEc2Id, exception.ImageNotFound): + filters = {'name': ec2_id} + images = self.image_service.detail(context, filters=filters) try: - return self.image_service.show_by_name(context, ec2_id) - except exception.NotFound: + return images[0] + except IndexError: raise exception.ImageNotFound(image_id=ec2_id) image_type = ec2_id.split('-')[0] if ec2utils.image_type(image.get('container_format')) != image_type: |
