Establish the supported importable interface

* Consumers of this client should not depend on being able to import
  any module other than glanceclient and glanceclient
* The only attributs of the glanceclient module are Client
  and __version__
* The attributes of the glanceclient.exc modules have yet to be
  locked down
* glanceclient.common.exceptions was replaced with a placeholder
  module until consumers of it are updated

Change-Id: Iea9648cd06906d65764987c1f2ee5a88ebeee748
This commit is contained in:
Brian Waldon
2012-07-12 18:30:54 -07:00
parent 49bc6f94f2
commit 53acf1a0ca
7 changed files with 161 additions and 149 deletions
+5 -5
View File
@@ -18,7 +18,7 @@ import uuid
import prettytable
from glanceclient.common import exceptions
from glanceclient import exc
from glanceclient.openstack.common import importutils
@@ -67,23 +67,23 @@ def find_resource(manager, name_or_id):
try:
if isinstance(name_or_id, int) or name_or_id.isdigit():
return manager.get(int(name_or_id))
except exceptions.NotFound:
except exc.NotFound:
pass
# now try to get entity as uuid
try:
uuid.UUID(str(name_or_id))
return manager.get(name_or_id)
except (ValueError, exceptions.NotFound):
except (ValueError, exc.NotFound):
pass
# finally try to find entity by name
try:
return manager.find(name=name_or_id)
except exceptions.NotFound:
except exc.NotFound:
msg = "No %s with a name or ID of '%s' exists." % \
(manager.resource_class.__name__.lower(), name_or_id)
raise exceptions.CommandError(msg)
raise exc.CommandError(msg)
def skip_authentication(f):