Clean up pep8 E124 violations
Fixed E124 errors All other ignores are to be removed in the next sequence of patches Change-Id: Ic96ebf5dff645dfdc47478beeb6965d6ad266243
This commit is contained in:
parent
8a8b01174c
commit
305a9c12b5
@ -29,8 +29,7 @@ from webob.exc import (HTTPError,
|
||||
HTTPBadRequest,
|
||||
HTTPForbidden,
|
||||
HTTPRequestEntityTooLarge,
|
||||
HTTPServiceUnavailable,
|
||||
)
|
||||
HTTPServiceUnavailable)
|
||||
|
||||
from glance.api import common
|
||||
from glance.api import policy
|
||||
|
@ -45,15 +45,16 @@ class RequestContext(object):
|
||||
def to_dict(self):
|
||||
# NOTE(ameade): These keys are named to correspond with the default
|
||||
# format string for logging the context in openstack common
|
||||
return {'request_id': self.request_id,
|
||||
'user_id': self.user,
|
||||
'tenant_id': self.tenant,
|
||||
'is_admin': self.is_admin,
|
||||
'project_id': self.tenant,
|
||||
'read_deleted': self.show_deleted,
|
||||
'roles': self.roles,
|
||||
'auth_token': self.auth_tok,
|
||||
'service_catalog': self.service_catalog,
|
||||
return {
|
||||
'request_id': self.request_id,
|
||||
'user_id': self.user,
|
||||
'tenant_id': self.tenant,
|
||||
'is_admin': self.is_admin,
|
||||
'project_id': self.tenant,
|
||||
'read_deleted': self.show_deleted,
|
||||
'roles': self.roles,
|
||||
'auth_token': self.auth_tok,
|
||||
'service_catalog': self.service_catalog,
|
||||
}
|
||||
|
||||
@classmethod
|
||||
|
@ -107,8 +107,7 @@ def get_client(host, port=None, timeout=None, use_ssl=False, username=None,
|
||||
auth_url=auth_url or os.getenv('OS_AUTH_URL'),
|
||||
strategy=force_strategy or auth_strategy or
|
||||
os.getenv('OS_AUTH_STRATEGY', 'noauth'),
|
||||
region=region or os.getenv('OS_REGION_NAME'),
|
||||
)
|
||||
region=region or os.getenv('OS_REGION_NAME'))
|
||||
|
||||
if creds['strategy'] == 'keystone' and not creds['auth_url']:
|
||||
msg = ("--os_auth_url option or OS_AUTH_URL environment variable "
|
||||
|
@ -30,12 +30,13 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
store_opts = [
|
||||
cfg.ListOpt('known_stores',
|
||||
default=['glance.store.filesystem.Store',
|
||||
'glance.store.http.Store',
|
||||
'glance.store.rbd.Store',
|
||||
'glance.store.s3.Store',
|
||||
'glance.store.swift.Store',
|
||||
]),
|
||||
default=[
|
||||
'glance.store.filesystem.Store',
|
||||
'glance.store.http.Store',
|
||||
'glance.store.rbd.Store',
|
||||
'glance.store.s3.Store',
|
||||
'glance.store.swift.Store',
|
||||
]),
|
||||
cfg.StrOpt('scrubber_datadir',
|
||||
default='/var/lib/glance/scrubber'),
|
||||
cfg.BoolOpt('delayed_delete', default=False),
|
||||
|
@ -269,9 +269,10 @@ class BaseTestCase(object):
|
||||
|
||||
def test_image_get_all_size_min_max(self):
|
||||
images = self.db_api.image_get_all(self.context,
|
||||
filters={'size_min': 10,
|
||||
filters={
|
||||
'size_min': 10,
|
||||
'size_max': 15,
|
||||
})
|
||||
})
|
||||
self.assertEquals(len(images), 1)
|
||||
self.assertEquals(images[0]['id'], self.fixtures[0]['id'])
|
||||
|
||||
|
@ -498,16 +498,20 @@ class TestEndpoints(utils.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.service_catalog = [
|
||||
{'endpoint_links': [],
|
||||
'endpoints': [
|
||||
{'adminURL': 'http://localhost:8080/',
|
||||
'region': 'RegionOne',
|
||||
'internalURL': 'http://internalURL/',
|
||||
'publicURL': 'http://publicURL/'},
|
||||
],
|
||||
'type': 'object-store',
|
||||
'name': 'Object Storage Service',
|
||||
}]
|
||||
{
|
||||
'endpoint_links': [],
|
||||
'endpoints': [
|
||||
{
|
||||
'adminURL': 'http://localhost:8080/',
|
||||
'region': 'RegionOne',
|
||||
'internalURL': 'http://internalURL/',
|
||||
'publicURL': 'http://publicURL/',
|
||||
},
|
||||
],
|
||||
'type': 'object-store',
|
||||
'name': 'Object Storage Service',
|
||||
}
|
||||
]
|
||||
|
||||
def test_get_endpoint_with_custom_server_type(self):
|
||||
endpoint = auth.get_endpoint(self.service_catalog,
|
||||
|
@ -884,12 +884,13 @@ class TestRegistryClient(base.IsolatedUnitTest):
|
||||
|
||||
def test_add_image_basic(self):
|
||||
"""Tests that we can add image metadata and returns the new id"""
|
||||
fixture = {'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'disk_format': 'vmdk',
|
||||
'container_format': 'ovf',
|
||||
'size': 19,
|
||||
}
|
||||
fixture = {
|
||||
'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'disk_format': 'vmdk',
|
||||
'container_format': 'ovf',
|
||||
'size': 19,
|
||||
}
|
||||
|
||||
new_image = self.client.add_image(fixture)
|
||||
|
||||
@ -925,14 +926,15 @@ class TestRegistryClient(base.IsolatedUnitTest):
|
||||
|
||||
def test_add_image_already_exists(self):
|
||||
"""Tests proper exception is raised if image with ID already exists"""
|
||||
fixture = {'id': UUID2,
|
||||
'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'disk_format': 'vmdk',
|
||||
'container_format': 'ovf',
|
||||
'size': 19,
|
||||
'location': "file:///tmp/glance-tests/2",
|
||||
}
|
||||
fixture = {
|
||||
'id': UUID2,
|
||||
'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'disk_format': 'vmdk',
|
||||
'container_format': 'ovf',
|
||||
'size': 19,
|
||||
'location': "file:///tmp/glance-tests/2",
|
||||
}
|
||||
|
||||
self.assertRaises(exception.Duplicate,
|
||||
self.client.add_image,
|
||||
@ -940,14 +942,15 @@ class TestRegistryClient(base.IsolatedUnitTest):
|
||||
|
||||
def test_add_image_with_bad_status(self):
|
||||
"""Tests proper exception is raised if a bad status is set"""
|
||||
fixture = {'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'disk_format': 'vmdk',
|
||||
'container_format': 'ovf',
|
||||
'status': 'bad status',
|
||||
'size': 19,
|
||||
'location': "file:///tmp/glance-tests/2",
|
||||
}
|
||||
fixture = {
|
||||
'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'disk_format': 'vmdk',
|
||||
'container_format': 'ovf',
|
||||
'status': 'bad status',
|
||||
'size': 19,
|
||||
'location': "file:///tmp/glance-tests/2",
|
||||
}
|
||||
|
||||
self.assertRaises(exception.Invalid,
|
||||
self.client.add_image,
|
||||
@ -968,12 +971,13 @@ class TestRegistryClient(base.IsolatedUnitTest):
|
||||
|
||||
def test_update_image_not_existing(self):
|
||||
"""Tests non existing image update doesn't work"""
|
||||
fixture = {'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'disk_format': 'vmdk',
|
||||
'container_format': 'ovf',
|
||||
'status': 'bad status',
|
||||
}
|
||||
fixture = {
|
||||
'name': 'fake public image',
|
||||
'is_public': True,
|
||||
'disk_format': 'vmdk',
|
||||
'container_format': 'ovf',
|
||||
'status': 'bad status',
|
||||
}
|
||||
|
||||
self.assertRaises(exception.NotFound,
|
||||
self.client.update_image,
|
||||
|
@ -137,8 +137,7 @@ class TestMigrations(utils.BaseTestCase):
|
||||
"|| tablename || ' cascade;' "
|
||||
"from pg_tables where schemaname = 'public';\" | "
|
||||
"psql -d %(database)s | grep '^\s*drop' | "
|
||||
"psql -d %(database)s"
|
||||
) % locals()
|
||||
"psql -d %(database)s") % locals()
|
||||
exitcode, out, err = utils.execute(cmd)
|
||||
self.assertEqual(0, exitcode)
|
||||
|
||||
|
@ -61,9 +61,10 @@ class TestImagesController(base.StoreClearingUnitTest):
|
||||
self.assertEqual(4, output['meta']['size'])
|
||||
self.assertEqual('YYYY', output['data'])
|
||||
output_log = self.notifier.get_log()
|
||||
expected_log = {'notification_type': "INFO",
|
||||
'event_type': "image.upload",
|
||||
'payload': output['meta'],
|
||||
expected_log = {
|
||||
'notification_type': "INFO",
|
||||
'event_type': "image.upload",
|
||||
'payload': output['meta'],
|
||||
}
|
||||
self.assertEqual(output_log, expected_log)
|
||||
|
||||
|
@ -328,9 +328,10 @@ class TestImagesController(test_utils.BaseTestCase):
|
||||
self.assertEqual([], output['tags'])
|
||||
self.assertEqual(False, output['is_public'])
|
||||
output_log = self.notifier.get_log()
|
||||
expected_log = {'notification_type': "INFO",
|
||||
'event_type': "image.update",
|
||||
'payload': output,
|
||||
expected_log = {
|
||||
'notification_type': "INFO",
|
||||
'event_type': "image.update",
|
||||
'payload': output,
|
||||
}
|
||||
self.assertEqual(output_log, expected_log)
|
||||
|
||||
@ -340,9 +341,10 @@ class TestImagesController(test_utils.BaseTestCase):
|
||||
output = self.controller.create(request, image)
|
||||
self.assertEqual(True, output['is_public'])
|
||||
output_log = self.notifier.get_log()
|
||||
expected_log = {'notification_type': "INFO",
|
||||
'event_type': "image.update",
|
||||
'payload': output,
|
||||
expected_log = {
|
||||
'notification_type': "INFO",
|
||||
'event_type': "image.update",
|
||||
'payload': output,
|
||||
}
|
||||
self.assertEqual(output_log, expected_log)
|
||||
|
||||
@ -352,10 +354,11 @@ class TestImagesController(test_utils.BaseTestCase):
|
||||
output = self.controller.create(request, image)
|
||||
self.assertEqual(['ping'], output['tags'])
|
||||
output_log = self.notifier.get_log()
|
||||
expected_log = {'notification_type': "INFO",
|
||||
'event_type': "image.update",
|
||||
'payload': output,
|
||||
}
|
||||
expected_log = {
|
||||
'notification_type': "INFO",
|
||||
'event_type': "image.update",
|
||||
'payload': output,
|
||||
}
|
||||
self.assertEqual(output_log, expected_log)
|
||||
|
||||
def test_update_no_changes(self):
|
||||
@ -365,9 +368,10 @@ class TestImagesController(test_utils.BaseTestCase):
|
||||
self.assertEqual(output['created_at'], output['updated_at'])
|
||||
self.assertTrue('tags' in output)
|
||||
output_log = self.notifier.get_log()
|
||||
expected_log = {'notification_type': "INFO",
|
||||
'event_type': "image.update",
|
||||
'payload': output,
|
||||
expected_log = {
|
||||
'notification_type': "INFO",
|
||||
'event_type': "image.update",
|
||||
'payload': output,
|
||||
}
|
||||
self.assertEqual(output_log, expected_log)
|
||||
|
||||
@ -525,9 +529,10 @@ class TestImagesController(test_utils.BaseTestCase):
|
||||
output = self.controller.update(request, UUID1, changes)
|
||||
self.assertEqual(['ping'], output['tags'])
|
||||
output_log = self.notifier.get_log()
|
||||
expected_log = {'notification_type': "INFO",
|
||||
'event_type': "image.update",
|
||||
'payload': output,
|
||||
expected_log = {
|
||||
'notification_type': "INFO",
|
||||
'event_type': "image.update",
|
||||
'payload': output,
|
||||
}
|
||||
self.assertEqual(output_log, expected_log)
|
||||
|
||||
|
@ -328,10 +328,11 @@ def xattr_writes_supported(path):
|
||||
|
||||
|
||||
def minimal_headers(name, public=True):
|
||||
headers = {'Content-Type': 'application/octet-stream',
|
||||
'X-Image-Meta-Name': name,
|
||||
'X-Image-Meta-disk_format': 'raw',
|
||||
'X-Image-Meta-container_format': 'ovf',
|
||||
headers = {
|
||||
'Content-Type': 'application/octet-stream',
|
||||
'X-Image-Meta-Name': name,
|
||||
'X-Image-Meta-disk_format': 'raw',
|
||||
'X-Image-Meta-container_format': 'ovf',
|
||||
}
|
||||
if public:
|
||||
headers['X-Image-Meta-Is-Public'] = 'True'
|
||||
|
2
tox.ini
2
tox.ini
@ -18,7 +18,7 @@ downloadcache = ~/cache/pip
|
||||
|
||||
[testenv:pep8]
|
||||
deps = pep8==1.3.3
|
||||
commands = pep8 --ignore=E124,E125,E126,E127,E128,E711 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack .
|
||||
commands = pep8 --ignore=E125,E126,E127,E128,E711 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack .
|
||||
|
||||
[testenv:cover]
|
||||
setenv = NOSE_WITH_COVERAGE=1
|
||||
|
Loading…
Reference in New Issue
Block a user