Merge "Clean up pep8 E122, E123 violations"

This commit is contained in:
Jenkins
2012-09-21 16:24:00 +00:00
committed by Gerrit Code Review
25 changed files with 72 additions and 78 deletions

View File

@@ -27,10 +27,10 @@ from glance.openstack.common import policy
LOG = logging.getLogger(__name__)
policy_opts = (
policy_opts = [
cfg.StrOpt('policy_file', default='policy.json'),
cfg.StrOpt('policy_default_rule', default='default'),
)
]
CONF = cfg.CONF
CONF.register_opts(policy_opts)

View File

@@ -89,12 +89,14 @@ def upgrade(migrate_engine):
# which returns all the images that have a type set
# but that DO NOT yet have an image_property record
# with key of type.
sel = select([images], from_obj=[
from_stmt = [
images.outerjoin(image_properties,
and_(images.c.id == image_properties.c.image_id,
image_properties.c.key == 'type'))]).where(
and_(image_properties.c.image_id == None,
images.c.type != None))
image_properties.c.key == 'type'))
]
and_stmt = and_(image_properties.c.image_id == None,
images.c.type != None)
sel = select([images], from_obj=from_stmt).where(and_stmt)
image_records = conn.execute(sel).fetchall()
property_insert = image_properties.insert()
for record in image_records:

View File

@@ -104,14 +104,12 @@ def legacy_parse_uri(self, uri):
# swift://user:pass@http://authurl.com/v1/container/obj
# are immediately rejected.
if uri.count('://') != 1:
reason = _(
"URI cannot contain more than one occurrence of a scheme."
reason = _("URI cannot contain more than one occurrence of a scheme."
"If you have specified a URI like "
"swift://user:pass@http://authurl.com/v1/container/obj"
", you need to change it to use the swift+http:// scheme, "
"like so: "
"swift+http://user:pass@authurl.com/v1/container/obj"
)
"swift+http://user:pass@authurl.com/v1/container/obj")
LOG.error(_("Invalid store uri %(uri)s: %(reason)s") % locals())
raise exception.BadStoreUri(message=reason)

View File

@@ -102,16 +102,14 @@ class StoreLocation(glance.store.location.StoreLocation):
# s3://accesskey:secretkey@https://s3.amazonaws.com/bucket/key-id
# are immediately rejected.
if uri.count('://') != 1:
reason = _(
"URI cannot contain more than one occurrence of a scheme."
"If you have specified a URI like "
"s3://accesskey:secretkey@https://s3.amazonaws.com/bucket/"
"key-id"
", you need to change it to use the s3+https:// scheme, "
"like so: "
"s3+https://accesskey:secretkey@s3.amazonaws.com/bucket/"
"key-id"
)
reason = _("URI cannot contain more than one occurrence "
"of a scheme. If you have specified a URI like "
"s3://accesskey:secretkey@"
"https://s3.amazonaws.com/bucket/key-id"
", you need to change it to use the "
"s3+https:// scheme, like so: "
"s3+https://accesskey:secretkey@"
"s3.amazonaws.com/bucket/key-id")
LOG.error(_("Invalid store uri %(uri)s: %(reason)s") % locals())
raise exception.BadStoreUri(message=reason)

View File

@@ -128,14 +128,12 @@ class StoreLocation(glance.store.location.StoreLocation):
# swift://user:pass@http://authurl.com/v1/container/obj
# are immediately rejected.
if uri.count('://') != 1:
reason = _(
"URI cannot contain more than one occurrence of a scheme."
"If you have specified a URI like "
reason = _("URI cannot contain more than one occurrence "
"of a scheme. If you have specified a URI like "
"swift://user:pass@http://authurl.com/v1/container/obj"
", you need to change it to use the swift+http:// scheme, "
"like so: "
"swift+http://user:pass@authurl.com/v1/container/obj"
)
", you need to change it to use the "
"swift+http:// scheme, like so: "
"swift+http://user:pass@authurl.com/v1/container/obj")
LOG.error(_("Invalid store uri %(uri)s: %(reason)s") % locals())
raise exception.BadStoreUri(message=reason)

View File

@@ -349,15 +349,13 @@ class TestMigrations(utils.BaseTestCase):
# Insert images with an unquoted image location
now = datetime.datetime.now()
kwargs = dict(
deleted=False,
kwargs = dict(deleted=False,
created_at=now,
updated_at=now,
status='active',
is_public=True,
min_disk=0,
min_ram=0,
)
min_ram=0)
for i, location in enumerate(unquoted_locations):
kwargs.update(location=location, id=i)
conn.execute(images_table.insert(), [kwargs])

View File

@@ -236,8 +236,8 @@ class SwiftTests(object):
http:// in the swift_store_auth_address config value
"""
loc = get_location_from_uri("swift+http://%s:key@auth_address/"
"glance/%s" % (
self.swift_store_user, FAKE_UUID))
"glance/%s" %
(self.swift_store_user, FAKE_UUID))
(image_swift, image_size) = self.store.get(loc)
self.assertEqual(image_size, 5120)

View File

@@ -18,7 +18,7 @@ downloadcache = ~/cache/pip
[testenv:pep8]
deps = pep8==1.3.3
commands = pep8 --ignore=E122,E123,E124,E125,E126,E127,E128,E711 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack .
commands = pep8 --ignore=E124,E125,E126,E127,E128,E711 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack .
[testenv:cover]
setenv = NOSE_WITH_COVERAGE=1