Merge "Fix various Pep8 1.5.4 errors"

This commit is contained in:
Jenkins 2014-05-20 15:11:05 +00:00 committed by Gerrit Code Review
commit b6fdfd3965
6 changed files with 31 additions and 36 deletions

View File

@ -134,10 +134,10 @@ def upload_data_to_store(req, image_meta, image_data, store, notifier):
# Update the database with the checksum returned
# from the backend store
LOG.debug(_("Updating image %(image_id)s data. "
"Checksum set to %(checksum)s, size set "
"to %(size)d"), {'image_id': image_id,
'checksum': checksum,
'size': size})
"Checksum set to %(checksum)s, size set "
"to %(size)d"), {'image_id': image_id,
'checksum': checksum,
'size': size})
update_data = {'checksum': checksum,
'size': size}
try:

View File

@ -152,7 +152,7 @@ class ImageService(object):
response = self._http_request('GET', url, {}, '')
result = jsonutils.loads(response.read())
if not result or not 'images' in result or not result['images']:
if not result or 'images' not in result or not result['images']:
return
for image in result.get('images', []):
params['marker'] = image['id']
@ -361,8 +361,8 @@ def _dict_diff(a, b):
for key in a:
if str(a[key]) != str(b[key]):
logging.debug(_('metadata diff -- value differs for key '
'%(key)s: master "%(master_value)s" vs '
'slave "%(slave_value)s"') %
'%(key)s: master "%(master_value)s" vs '
'slave "%(slave_value)s"') %
{'key': key, 'master_value': a[key],
'slave_value': b[key]})
return True
@ -564,8 +564,8 @@ def replication_compare(options, args):
for key in image:
if image[key] != headers.get(key, None):
logging.info(_('%(image_id)s: field %(key)s differs '
'(source is %(master_value)s, destination '
'is %(slave_value)s)')
'(source is %(master_value)s, destination '
'is %(slave_value)s)')
% {'image_id': image['id'],
'key': key,
'master_value': image[key],

View File

@ -358,7 +358,7 @@ class TestApi(functional.FunctionalTest):
# 16. Attempt to replace members with an overlimit amount
# Adding 11 image members should fail since configured limit is 10
path = ("http://%s:%d/v1/images/%s/members" %
("127.0.0.1", self.api_port, image_id))
("127.0.0.1", self.api_port, image_id))
memberships = []
for i in range(11):
member_id = "foo%d" % i
@ -371,7 +371,7 @@ class TestApi(functional.FunctionalTest):
# 17. Attempt to add a member while at limit
# Adding an 11th member should fail since configured limit is 10
path = ("http://%s:%d/v1/images/%s/members" %
("127.0.0.1", self.api_port, image_id))
("127.0.0.1", self.api_port, image_id))
memberships = []
for i in range(10):
member_id = "foo%d" % i
@ -382,7 +382,7 @@ class TestApi(functional.FunctionalTest):
self.assertEqual(response.status, 204)
path = ("http://%s:%d/v1/images/%s/members/fail_me" %
("127.0.0.1", self.api_port, image_id))
("127.0.0.1", self.api_port, image_id))
http = httplib2.Http()
response, content = http.request(path, 'PUT')
self.assertEqual(response.status, 413)

View File

@ -2056,7 +2056,7 @@ class TestImageLocationSelectionStrategy(functional.FunctionalTest):
self.assertTrue('locations' in image)
self.assertTrue(image["locations"] == [])
# Update image locations via PATCH
# Update image locations via PATCH
path = self._url('/v2/images/%s' % image_id)
media_type = 'application/openstack-images-v2.1-json-patch'
headers = self._headers({'content-type': media_type})
@ -2115,7 +2115,7 @@ class TestImageLocationSelectionStrategy(functional.FunctionalTest):
self.assertTrue('locations' in image)
self.assertTrue(image["locations"] == [])
# Update image locations via PATCH
# Update image locations via PATCH
path = self._url('/v2/images/%s' % image_id)
media_type = 'application/openstack-images-v2.1-json-patch'
headers = self._headers({'content-type': media_type})

View File

@ -97,10 +97,9 @@ class TestTasksApi(base.ApiTest):
body_content = json.dumps(task_data)
path = "/v2/tasks"
response, content = self.http.request(path, 'POST',
headers=
minimal_task_headers(task_owner),
body=body_content)
response, content = self.http.request(
path, 'POST', headers=minimal_task_headers(task_owner),
body=body_content)
self.assertEqual(response.status, 201)
data = json.loads(content)
@ -176,10 +175,9 @@ class TestTasksApi(base.ApiTest):
body_content = json.dumps(task_data)
path = "/v2/tasks"
response, content = self.http.request(path, 'POST',
headers=
minimal_task_headers(task_owner),
body=body_content)
response, content = self.http.request(
path, 'POST', headers=minimal_task_headers(task_owner),
body=body_content)
self.assertEqual(response.status, 201)
data = json.loads(content)
@ -198,10 +196,9 @@ class TestTasksApi(base.ApiTest):
body_content = json.dumps(task_data)
path = "/v2/tasks"
response, content = self.http.request(path, 'POST',
headers=
minimal_task_headers(task_owner),
body=body_content)
response, content = self.http.request(
path, 'POST', headers=minimal_task_headers(task_owner),
body=body_content)
self.assertEqual(response.status, 400)
# 1. POST /tasks
@ -212,10 +209,9 @@ class TestTasksApi(base.ApiTest):
body_content = json.dumps(task_data)
path = "/v2/tasks"
response, content = self.http.request(path, 'POST',
headers=
minimal_task_headers(task_owner),
body=body_content)
response, content = self.http.request(
path, 'POST', headers=minimal_task_headers(task_owner),
body=body_content)
self.assertEqual(response.status, 400)
def test_tasks_with_filter(self):
@ -513,10 +509,9 @@ class TestTasksApi(base.ApiTest):
body_content = json.dumps(task_data)
path = "/v2/tasks"
response, content = self.http.request(path, 'POST',
headers=
minimal_task_headers(task_owner),
body=body_content)
response, content = self.http.request(
path, 'POST', headers=minimal_task_headers(task_owner),
body=body_content)
self.assertEqual(response.status, 201)
data = json.loads(content)

View File

@ -48,8 +48,8 @@ class TestCinderStore(base.StoreClearingUnitTest):
store = cinder.Store(context=FakeObject(service_catalog=None))
self.assertRaises(exception.BadStoreConfiguration,
store.configure_add)
store = cinder.Store(context=FakeObject(service_catalog=
'fake_service_catalog'))
store = cinder.Store(context=FakeObject(
service_catalog='fake_service_catalog'))
store.configure_add()
def test_cinder_get_size(self):