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/image | |
| 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/image')
| -rw-r--r-- | nova/image/glance.py | 8 | ||||
| -rw-r--r-- | nova/image/s3.py | 9 |
2 files changed, 3 insertions, 14 deletions
diff --git a/nova/image/glance.py b/nova/image/glance.py index 9ad6da528..3a4099338 100644 --- a/nova/image/glance.py +++ b/nova/image/glance.py @@ -250,14 +250,6 @@ class GlanceImageService(object): base_image_meta = self._translate_from_glance(image_meta) return base_image_meta - def show_by_name(self, context, name): - """Returns a dict containing image data for the given name.""" - image_metas = self.detail(context, filters={'name': name}) - try: - return image_metas[0] - except (IndexError, TypeError): - raise exception.ImageNotFound(image_id=name) - def get(self, context, image_id, data): """Calls out to Glance for metadata and data and writes data.""" try: diff --git a/nova/image/s3.py b/nova/image/s3.py index b5a94cb3f..318847791 100644 --- a/nova/image/s3.py +++ b/nova/image/s3.py @@ -142,10 +142,11 @@ class S3ImageService(object): images = self.service.index(context, sort_dir='asc') return self._translate_uuids_to_ids(context, images) - def detail(self, context): + def detail(self, context, **kwargs): #NOTE(bcwaldon): sort asc to make sure we assign lower ids # to older images - images = self.service.detail(context, sort_dir='asc') + kwargs.setdefault('sort_dir', 'asc') + images = self.service.detail(context, **kwargs) return self._translate_uuids_to_ids(context, images) def show(self, context, image_id): @@ -153,10 +154,6 @@ class S3ImageService(object): image = self.service.show(context, image_uuid) return self._translate_uuid_to_id(context, image) - def show_by_name(self, context, name): - image = self.service.show_by_name(context, name) - return self._translate_uuid_to_id(context, image) - @staticmethod def _conn(context): # NOTE(vish): access and secret keys for s3 server are not |
