From 3a68f75b95ed7807aee6cc245ea175ac35a09b11 Mon Sep 17 00:00:00 2001 From: Brian Waldon <bcwaldon@gmail.com> Date: Wed, 8 Aug 2012 10:08:33 -0700 Subject: [PATCH] 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 --- glanceclient/exc.py | 5 ----- glanceclient/v2/schemas.py | 11 +---------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/glanceclient/exc.py b/glanceclient/exc.py index be0e0011..aa373245 100644 --- a/glanceclient/exc.py +++ b/glanceclient/exc.py @@ -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 diff --git a/glanceclient/v2/schemas.py b/glanceclient/v2/schemas.py index 6e178d28..79a48878 100644 --- a/glanceclient/v2/schemas.py +++ b/glanceclient/v2/schemas.py @@ -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)