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

@@ -29,7 +29,7 @@ context_opts = [
cfg.BoolOpt('owner_is_tenant', default=True), cfg.BoolOpt('owner_is_tenant', default=True),
cfg.StrOpt('admin_role', default='admin'), cfg.StrOpt('admin_role', default='admin'),
cfg.BoolOpt('allow_anonymous_access', default=False), cfg.BoolOpt('allow_anonymous_access', default=False),
] ]
CONF = cfg.CONF CONF = cfg.CONF
CONF.register_opts(context_opts) CONF.register_opts(context_opts)

View File

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

View File

@@ -34,7 +34,7 @@ from glance.version import version_info as version
paste_deploy_opts = [ paste_deploy_opts = [
cfg.StrOpt('flavor'), cfg.StrOpt('flavor'),
cfg.StrOpt('config_file'), cfg.StrOpt('config_file'),
] ]
common_opts = [ common_opts = [
cfg.BoolOpt('allow_additional_image_properties', default=True, cfg.BoolOpt('allow_additional_image_properties', default=True,
help=_('Whether to allow users to specify image properties ' help=_('Whether to allow users to specify image properties '

View File

@@ -54,7 +54,7 @@ db_opts = [
cfg.IntOpt('sql_max_retries', default=10), cfg.IntOpt('sql_max_retries', default=10),
cfg.IntOpt('sql_retry_interval', default=1), cfg.IntOpt('sql_retry_interval', default=1),
cfg.BoolOpt('db_auto_create', default=False), cfg.BoolOpt('db_auto_create', default=False),
] ]
CONF = cfg.CONF CONF = cfg.CONF
CONF.register_opts(db_opts) CONF.register_opts(db_opts)

View File

@@ -89,12 +89,14 @@ def upgrade(migrate_engine):
# which returns all the images that have a type set # which returns all the images that have a type set
# but that DO NOT yet have an image_property record # but that DO NOT yet have an image_property record
# with key of type. # with key of type.
sel = select([images], from_obj=[ from_stmt = [
images.outerjoin(image_properties, images.outerjoin(image_properties,
and_(images.c.id == image_properties.c.image_id, and_(images.c.id == image_properties.c.image_id,
image_properties.c.key == 'type'))]).where( image_properties.c.key == 'type'))
and_(image_properties.c.image_id == None, ]
images.c.type != None)) 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() image_records = conn.execute(sel).fetchall()
property_insert = image_properties.insert() property_insert = image_properties.insert()
for record in image_records: 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 # swift://user:pass@http://authurl.com/v1/container/obj
# are immediately rejected. # are immediately rejected.
if uri.count('://') != 1: if uri.count('://') != 1:
reason = _( reason = _("URI cannot contain more than one occurrence of a scheme."
"URI cannot contain more than one occurrence of a scheme."
"If you have specified a URI like " "If you have specified a URI like "
"swift://user:pass@http://authurl.com/v1/container/obj" "swift://user:pass@http://authurl.com/v1/container/obj"
", you need to change it to use the swift+http:// scheme, " ", you need to change it to use the swift+http:// scheme, "
"like so: " "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()) LOG.error(_("Invalid store uri %(uri)s: %(reason)s") % locals())
raise exception.BadStoreUri(message=reason) raise exception.BadStoreUri(message=reason)

View File

@@ -34,7 +34,7 @@ image_cache_opts = [
cfg.IntOpt('image_cache_max_size', default=10 * (1024 ** 3)), # 10 GB cfg.IntOpt('image_cache_max_size', default=10 * (1024 ** 3)), # 10 GB
cfg.IntOpt('image_cache_stall_time', default=86400), # 24 hours cfg.IntOpt('image_cache_stall_time', default=86400), # 24 hours
cfg.StrOpt('image_cache_dir'), cfg.StrOpt('image_cache_dir'),
] ]
CONF = cfg.CONF CONF = cfg.CONF
CONF.register_opts(image_cache_opts) CONF.register_opts(image_cache_opts)

View File

@@ -37,7 +37,7 @@ LOG = logging.getLogger(__name__)
sqlite_opts = [ sqlite_opts = [
cfg.StrOpt('image_cache_sqlite_db', default='cache.db'), cfg.StrOpt('image_cache_sqlite_db', default='cache.db'),
] ]
CONF = cfg.CONF CONF = cfg.CONF
CONF.register_opts(sqlite_opts) CONF.register_opts(sqlite_opts)

View File

@@ -27,7 +27,7 @@ from glance.openstack.common import timeutils
notifier_opts = [ notifier_opts = [
cfg.StrOpt('notifier_strategy', default='default') cfg.StrOpt('notifier_strategy', default='default')
] ]
CONF = cfg.CONF CONF = cfg.CONF
CONF.register_opts(notifier_opts) CONF.register_opts(notifier_opts)

View File

@@ -39,7 +39,7 @@ rabbit_opts = [
cfg.StrOpt('rabbit_max_retries', default=0), cfg.StrOpt('rabbit_max_retries', default=0),
cfg.StrOpt('rabbit_retry_backoff', default=2), cfg.StrOpt('rabbit_retry_backoff', default=2),
cfg.StrOpt('rabbit_retry_max_backoff', default=30) cfg.StrOpt('rabbit_retry_max_backoff', default=30)
] ]
CONF = cfg.CONF CONF = cfg.CONF
CONF.register_opts(rabbit_opts) CONF.register_opts(rabbit_opts)

View File

@@ -70,7 +70,7 @@ qpid_opts = [
cfg.BoolOpt('qpid_tcp_nodelay', cfg.BoolOpt('qpid_tcp_nodelay',
default=True, default=True,
help='Disable Nagle algorithm'), help='Disable Nagle algorithm'),
] ]
CONF = cfg.CONF CONF = cfg.CONF
CONF.register_opts(qpid_opts) CONF.register_opts(qpid_opts)

View File

@@ -31,14 +31,14 @@ LOG = logging.getLogger(__name__)
registry_addr_opts = [ registry_addr_opts = [
cfg.StrOpt('registry_host', default='0.0.0.0'), cfg.StrOpt('registry_host', default='0.0.0.0'),
cfg.IntOpt('registry_port', default=9191), cfg.IntOpt('registry_port', default=9191),
] ]
registry_client_opts = [ registry_client_opts = [
cfg.StrOpt('registry_client_protocol', default='http'), cfg.StrOpt('registry_client_protocol', default='http'),
cfg.StrOpt('registry_client_key_file'), cfg.StrOpt('registry_client_key_file'),
cfg.StrOpt('registry_client_cert_file'), cfg.StrOpt('registry_client_cert_file'),
cfg.StrOpt('registry_client_ca_file'), cfg.StrOpt('registry_client_ca_file'),
cfg.StrOpt('metadata_encryption_key', secret=True), cfg.StrOpt('metadata_encryption_key', secret=True),
] ]
registry_client_ctx_opts = [ registry_client_ctx_opts = [
cfg.StrOpt('admin_user', secret=True), cfg.StrOpt('admin_user', secret=True),
cfg.StrOpt('admin_password', secret=True), cfg.StrOpt('admin_password', secret=True),
@@ -46,7 +46,7 @@ registry_client_ctx_opts = [
cfg.StrOpt('auth_url'), cfg.StrOpt('auth_url'),
cfg.StrOpt('auth_strategy', default='noauth'), cfg.StrOpt('auth_strategy', default='noauth'),
cfg.StrOpt('auth_region'), cfg.StrOpt('auth_region'),
] ]
CONF = cfg.CONF CONF = cfg.CONF
CONF.register_opts(registry_addr_opts) CONF.register_opts(registry_addr_opts)

View File

@@ -40,7 +40,7 @@ store_opts = [
default='/var/lib/glance/scrubber'), default='/var/lib/glance/scrubber'),
cfg.BoolOpt('delayed_delete', default=False), cfg.BoolOpt('delayed_delete', default=False),
cfg.IntOpt('scrub_time', default=0), cfg.IntOpt('scrub_time', default=0),
] ]
CONF = cfg.CONF CONF = cfg.CONF
CONF.register_opts(store_opts) CONF.register_opts(store_opts)

View File

@@ -51,7 +51,7 @@ rbd_opts = [
cfg.StrOpt('rbd_store_pool', default=DEFAULT_POOL), cfg.StrOpt('rbd_store_pool', default=DEFAULT_POOL),
cfg.StrOpt('rbd_store_user', default=DEFAULT_USER), cfg.StrOpt('rbd_store_user', default=DEFAULT_USER),
cfg.StrOpt('rbd_store_ceph_conf', default=DEFAULT_CONFFILE), cfg.StrOpt('rbd_store_ceph_conf', default=DEFAULT_CONFFILE),
] ]
CONF = cfg.CONF CONF = cfg.CONF
CONF.register_opts(rbd_opts) CONF.register_opts(rbd_opts)

View File

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

View File

@@ -36,7 +36,7 @@ LOG = logging.getLogger(__name__)
scrubber_opts = [ scrubber_opts = [
cfg.BoolOpt('cleanup_scrubber', default=False), cfg.BoolOpt('cleanup_scrubber', default=False),
cfg.IntOpt('cleanup_scrubber_time', default=86400) cfg.IntOpt('cleanup_scrubber_time', default=86400)
] ]
CONF = cfg.CONF CONF = cfg.CONF
CONF.register_opts(scrubber_opts) CONF.register_opts(scrubber_opts)

View File

@@ -61,7 +61,7 @@ swift_opts = [
cfg.BoolOpt('swift_store_create_container_on_put', default=False), cfg.BoolOpt('swift_store_create_container_on_put', default=False),
cfg.BoolOpt('swift_store_multi_tenant', default=False), cfg.BoolOpt('swift_store_multi_tenant', default=False),
cfg.ListOpt('swift_store_admin_tenants', default=[]), cfg.ListOpt('swift_store_admin_tenants', default=[]),
] ]
CONF = cfg.CONF CONF = cfg.CONF
CONF.register_opts(swift_opts) CONF.register_opts(swift_opts)
@@ -128,14 +128,12 @@ class StoreLocation(glance.store.location.StoreLocation):
# swift://user:pass@http://authurl.com/v1/container/obj # swift://user:pass@http://authurl.com/v1/container/obj
# are immediately rejected. # are immediately rejected.
if uri.count('://') != 1: if uri.count('://') != 1:
reason = _( reason = _("URI cannot contain more than one occurrence "
"URI cannot contain more than one occurrence of a scheme." "of a scheme. If you have specified a URI like "
"If you have specified a URI like "
"swift://user:pass@http://authurl.com/v1/container/obj" "swift://user:pass@http://authurl.com/v1/container/obj"
", you need to change it to use the swift+http:// scheme, " ", you need to change it to use the "
"like so: " "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()) LOG.error(_("Invalid store uri %(uri)s: %(reason)s") % locals())
raise exception.BadStoreUri(message=reason) raise exception.BadStoreUri(message=reason)

View File

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

View File

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

View File

@@ -18,7 +18,7 @@ downloadcache = ~/cache/pip
[testenv:pep8] [testenv:pep8]
deps = pep8==1.3.3 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] [testenv:cover]
setenv = NOSE_WITH_COVERAGE=1 setenv = NOSE_WITH_COVERAGE=1