Simplify v2 schema lookup

We don't need to look at the container of available schemas in order
to get the one we want. Remove glanceclient.exc.SchemaNotFound as it can
no longer be raised.

Change-Id: Ib49ad58c4fdfc9bc9f535115674d92040a97db65
This commit is contained in:
Brian Waldon 2012-08-08 10:08:33 -07:00
parent 127463e14d
commit 3a68f75b95
2 changed files with 1 additions and 15 deletions
glanceclient

@ -33,11 +33,6 @@ class EndpointNotFound(Exception):
pass
class SchemaNotFound(KeyError):
"""Could not find schema"""
pass
class InvalidEndpoint(ValueError):
"""The provided endpoint could not be used"""
pass

@ -15,8 +15,6 @@
import copy
from glanceclient import exc
class SchemaProperty(object):
def __init__(self, name, **kwargs):
@ -51,13 +49,6 @@ class Controller(object):
self.http_client = http_client
def get(self, schema_name):
uri = self._find_schema_uri(schema_name)
uri = '/v2/schemas/%s' % schema_name
_, raw_schema = self.http_client.json_request('GET', uri)
return Schema(raw_schema)
def _find_schema_uri(self, schema_name):
_, schema_index = self.http_client.json_request('GET', '/v2/schemas')
try:
return schema_index[schema_name]
except KeyError:
raise exc.SchemaNotFound(schema_name)