Bug #696385: Glance is not pep8-clean

Fix all Glance's pep8 problems.
This commit is contained in:
Ewan Mellor
2011-01-02 02:47:59 +00:00
parent 39e1a3cc44
commit f11c8c4c07
11 changed files with 47 additions and 32 deletions

View File

@@ -73,7 +73,7 @@ class FilesystemBackend(Backend):
except OSError:
raise exception.NotAuthorized("You cannot delete file %s" % fn)
else:
raise exception.NotFound("File %s does not exist" % fn)
raise exception.NotFound("File %s does not exist" % fn)
def get_backend_class(backend):

View File

@@ -114,12 +114,12 @@ class FilesystemBackend(glance.store.Backend):
:retval The location that was written, with file:// scheme prepended
"""
datadir = FLAGS.filesystem_store_datadir
if not os.path.exists(datadir):
os.makedirs(datadir)
filepath = os.path.join(datadir, str(id))
if os.path.exists(filepath):

View File

@@ -19,6 +19,7 @@ import httplib
import glance.store
class HTTPBackend(glance.store.Backend):
""" An implementation of the HTTP Backend Adapter """
@@ -35,11 +36,12 @@ class HTTPBackend(glance.store.Backend):
elif parsed_uri.scheme == "https":
conn_class = httplib.HTTPSConnection
else:
raise glance.store.BackendException("scheme '%s' not supported for HTTPBackend")
raise glance.store.BackendException(
"scheme '%s' not supported for HTTPBackend")
conn = conn_class(parsed_uri.netloc)
conn.request("GET", parsed_uri.path, "", {})
try:
return glance.store._file_iter(conn.getresponse(), cls.CHUNKSIZE)
finally:

View File

@@ -29,14 +29,14 @@ class SwiftBackend(glance.store.Backend):
@classmethod
def get(cls, parsed_uri, expected_size, conn_class=None):
"""
Takes a parsed_uri in the format of:
swift://user:password@auth_url/container/file.gz.0, connects to the
swift instance at auth_url and downloads the file. Returns the generator
resp_body provided by get_object.
Takes a parsed_uri in the format of:
swift://user:password@auth_url/container/file.gz.0, connects to the
swift instance at auth_url and downloads the file. Returns the
generator resp_body provided by get_object.
"""
(user, key, authurl, container, obj) = \
cls._parse_swift_tokens(parsed_uri)
# TODO(sirp): snet=False for now, however, if the instance of
# swift we're talking to is within our same region, we should set
# snet=True
@@ -50,9 +50,10 @@ class SwiftBackend(glance.store.Backend):
obj_size = int(resp_headers['content-length'])
if obj_size != expected_size:
raise glance.store.BackendException("Expected %s byte file, Swift has %s bytes"
% (expected_size, obj_size))
raise glance.store.BackendException(
"Expected %s byte file, Swift has %s bytes" %
(expected_size, obj_size))
return resp_body
@classmethod
@@ -62,7 +63,7 @@ class SwiftBackend(glance.store.Backend):
"""
(user, key, authurl, container, obj) = \
cls._parse_swift_tokens(parsed_uri)
# TODO(sirp): snet=False for now, however, if the instance of
# swift we're talking to is within our same region, we should set
# snet=True
@@ -76,7 +77,7 @@ class SwiftBackend(glance.store.Backend):
# TODO(jaypipes): What to return here? After reading the docs
# at swift.common.client, I'm not sure what to check for...
@classmethod
def _parse_swift_tokens(cls, parsed_uri):
"""