Fix pep8 E warning for hacking 0.10
Fix pep8 warnings of the E category of hacking 0.10: * E113: unexpected indentation * E121: continuation line under-indented for hanging indent * E122: continuation line missing indentation or outdented * E123: closing bracket does not match indentation of opening bracket's line * E126: continuation line over-indented for hanging indent * E251: unexpected spaces around keyword / parameter equals Change-Id: I0b24eebdf1a37dc1b572b6c9a3d3d4832d050237
This commit is contained in:
parent
d719064e78
commit
389a97e352
@ -122,11 +122,10 @@ class AccountAuditor(Daemon):
|
|||||||
continue
|
continue
|
||||||
raise InvalidAccountInfo(_(
|
raise InvalidAccountInfo(_(
|
||||||
'The total %(key)s for the container (%(total)s) does not '
|
'The total %(key)s for the container (%(total)s) does not '
|
||||||
'match the sum of %(key)s across policies (%(sum)s)') % {
|
'match the sum of %(key)s across policies (%(sum)s)')
|
||||||
'key': key,
|
% {'key': key,
|
||||||
'total': info[key],
|
'total': info[key],
|
||||||
'sum': policy_totals[key],
|
'sum': policy_totals[key]})
|
||||||
})
|
|
||||||
|
|
||||||
def account_audit(self, path):
|
def account_audit(self, path):
|
||||||
"""
|
"""
|
||||||
|
@ -543,8 +543,8 @@ def retry(func, *args, **kwargs):
|
|||||||
# Shouldn't actually get down here, but just in case.
|
# Shouldn't actually get down here, but just in case.
|
||||||
if args and 'ip' in args[0]:
|
if args and 'ip' in args[0]:
|
||||||
raise ClientException('Raise too many retries',
|
raise ClientException('Raise too many retries',
|
||||||
http_host=args[
|
http_host=args[0]['ip'],
|
||||||
0]['ip'], http_port=args[0]['port'],
|
http_port=args[0]['port'],
|
||||||
http_device=args[0]['device'])
|
http_device=args[0]['device'])
|
||||||
else:
|
else:
|
||||||
raise ClientException('Raise too many retries')
|
raise ClientException('Raise too many retries')
|
||||||
|
@ -674,15 +674,15 @@ class TempAuth(object):
|
|||||||
user = req.headers.get('x-auth-user')
|
user = req.headers.get('x-auth-user')
|
||||||
if not user or ':' not in user:
|
if not user or ':' not in user:
|
||||||
self.logger.increment('token_denied')
|
self.logger.increment('token_denied')
|
||||||
return HTTPUnauthorized(request=req, headers=
|
auth = 'Swift realm="%s"' % account
|
||||||
{'Www-Authenticate':
|
return HTTPUnauthorized(request=req,
|
||||||
'Swift realm="%s"' % account})
|
headers={'Www-Authenticate': auth})
|
||||||
account2, user = user.split(':', 1)
|
account2, user = user.split(':', 1)
|
||||||
if account != account2:
|
if account != account2:
|
||||||
self.logger.increment('token_denied')
|
self.logger.increment('token_denied')
|
||||||
return HTTPUnauthorized(request=req, headers=
|
auth = 'Swift realm="%s"' % account
|
||||||
{'Www-Authenticate':
|
return HTTPUnauthorized(request=req,
|
||||||
'Swift realm="%s"' % account})
|
headers={'Www-Authenticate': auth})
|
||||||
key = req.headers.get('x-storage-pass')
|
key = req.headers.get('x-storage-pass')
|
||||||
if not key:
|
if not key:
|
||||||
key = req.headers.get('x-auth-key')
|
key = req.headers.get('x-auth-key')
|
||||||
@ -692,9 +692,9 @@ class TempAuth(object):
|
|||||||
user = req.headers.get('x-storage-user')
|
user = req.headers.get('x-storage-user')
|
||||||
if not user or ':' not in user:
|
if not user or ':' not in user:
|
||||||
self.logger.increment('token_denied')
|
self.logger.increment('token_denied')
|
||||||
return HTTPUnauthorized(request=req, headers=
|
auth = 'Swift realm="unknown"'
|
||||||
{'Www-Authenticate':
|
return HTTPUnauthorized(request=req,
|
||||||
'Swift realm="unknown"'})
|
headers={'Www-Authenticate': auth})
|
||||||
account, user = user.split(':', 1)
|
account, user = user.split(':', 1)
|
||||||
key = req.headers.get('x-auth-key')
|
key = req.headers.get('x-auth-key')
|
||||||
if not key:
|
if not key:
|
||||||
@ -711,14 +711,14 @@ class TempAuth(object):
|
|||||||
account_user = account + ':' + user
|
account_user = account + ':' + user
|
||||||
if account_user not in self.users:
|
if account_user not in self.users:
|
||||||
self.logger.increment('token_denied')
|
self.logger.increment('token_denied')
|
||||||
return HTTPUnauthorized(request=req, headers=
|
auth = 'Swift realm="%s"' % account
|
||||||
{'Www-Authenticate':
|
return HTTPUnauthorized(request=req,
|
||||||
'Swift realm="%s"' % account})
|
headers={'Www-Authenticate': auth})
|
||||||
if self.users[account_user]['key'] != key:
|
if self.users[account_user]['key'] != key:
|
||||||
self.logger.increment('token_denied')
|
self.logger.increment('token_denied')
|
||||||
return HTTPUnauthorized(request=req, headers=
|
auth = 'Swift realm="unknown"'
|
||||||
{'Www-Authenticate':
|
return HTTPUnauthorized(request=req,
|
||||||
'Swift realm="unknown"'})
|
headers={'Www-Authenticate': auth})
|
||||||
account_id = self.users[account_user]['url'].rsplit('/', 1)[-1]
|
account_id = self.users[account_user]['url'].rsplit('/', 1)[-1]
|
||||||
# Get memcache client
|
# Get memcache client
|
||||||
memcache_client = cache_from_env(req.environ)
|
memcache_client = cache_from_env(req.environ)
|
||||||
|
@ -319,11 +319,11 @@ class ObjectReconstructor(Daemon):
|
|||||||
except (Exception, Timeout):
|
except (Exception, Timeout):
|
||||||
self.logger.exception(
|
self.logger.exception(
|
||||||
_("Error trying to rebuild %(path)s "
|
_("Error trying to rebuild %(path)s "
|
||||||
"policy#%(policy)d frag#%(frag_index)s"), {
|
"policy#%(policy)d frag#%(frag_index)s"),
|
||||||
'path': path,
|
{'path': path,
|
||||||
'policy': policy,
|
'policy': policy,
|
||||||
'frag_index': frag_index,
|
'frag_index': frag_index,
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
if not all(fragment_payload):
|
if not all(fragment_payload):
|
||||||
break
|
break
|
||||||
@ -486,14 +486,11 @@ class ObjectReconstructor(Daemon):
|
|||||||
self._full_path(node, job['partition'], '',
|
self._full_path(node, job['partition'], '',
|
||||||
job['policy']))
|
job['policy']))
|
||||||
elif resp.status != HTTP_OK:
|
elif resp.status != HTTP_OK:
|
||||||
|
full_path = self._full_path(node, job['partition'], '',
|
||||||
|
job['policy'])
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
_("Invalid response %(resp)s "
|
_("Invalid response %(resp)s from %(full_path)s"),
|
||||||
"from %(full_path)s"), {
|
{'resp': resp.status, 'full_path': full_path})
|
||||||
'resp': resp.status,
|
|
||||||
'full_path': self._full_path(
|
|
||||||
node, job['partition'], '',
|
|
||||||
job['policy'])
|
|
||||||
})
|
|
||||||
else:
|
else:
|
||||||
remote_suffixes = pickle.loads(resp.read())
|
remote_suffixes = pickle.loads(resp.read())
|
||||||
except (Exception, Timeout):
|
except (Exception, Timeout):
|
||||||
|
@ -569,11 +569,11 @@ class Application(object):
|
|||||||
else:
|
else:
|
||||||
log = self.logger.exception
|
log = self.logger.exception
|
||||||
log(_('ERROR with %(type)s server %(ip)s:%(port)s/%(device)s'
|
log(_('ERROR with %(type)s server %(ip)s:%(port)s/%(device)s'
|
||||||
' re: %(info)s'), {
|
' re: %(info)s'),
|
||||||
'type': typ, 'ip': node['ip'], 'port':
|
{'type': typ, 'ip': node['ip'],
|
||||||
node['port'], 'device': node['device'],
|
'port': node['port'], 'device': node['device'],
|
||||||
'info': additional_info
|
'info': additional_info},
|
||||||
}, **kwargs)
|
**kwargs)
|
||||||
|
|
||||||
def modify_wsgi_pipeline(self, pipe):
|
def modify_wsgi_pipeline(self, pipe):
|
||||||
"""
|
"""
|
||||||
|
@ -940,9 +940,9 @@ class TestContainerController(unittest.TestCase):
|
|||||||
snowman = u'\u2603'
|
snowman = u'\u2603'
|
||||||
container_name = snowman.encode('utf-8')
|
container_name = snowman.encode('utf-8')
|
||||||
req = Request.blank(
|
req = Request.blank(
|
||||||
'/sda1/p/a/%s' % container_name, environ={
|
'/sda1/p/a/%s' % container_name,
|
||||||
'REQUEST_METHOD': 'PUT',
|
environ={'REQUEST_METHOD': 'PUT',
|
||||||
'HTTP_X_TIMESTAMP': '1'})
|
'HTTP_X_TIMESTAMP': '1'})
|
||||||
resp = req.get_response(self.controller)
|
resp = req.get_response(self.controller)
|
||||||
self.assertEquals(resp.status_int, 201)
|
self.assertEquals(resp.status_int, 201)
|
||||||
|
|
||||||
|
@ -2240,12 +2240,11 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEquals(len(os.listdir(os.path.dirname(ts_1000_file))), 1)
|
self.assertEquals(len(os.listdir(os.path.dirname(ts_1000_file))), 1)
|
||||||
|
|
||||||
orig_timestamp = utils.Timestamp(1002).internal
|
orig_timestamp = utils.Timestamp(1002).internal
|
||||||
|
headers = {'X-Timestamp': orig_timestamp,
|
||||||
|
'Content-Type': 'application/octet-stream',
|
||||||
|
'Content-Length': '4'}
|
||||||
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
headers={
|
headers=headers)
|
||||||
'X-Timestamp': orig_timestamp,
|
|
||||||
'Content-Type': 'application/octet-stream',
|
|
||||||
'Content-Length': '4',
|
|
||||||
})
|
|
||||||
req.body = 'test'
|
req.body = 'test'
|
||||||
resp = req.get_response(self.object_controller)
|
resp = req.get_response(self.object_controller)
|
||||||
self.assertEquals(resp.status_int, 201)
|
self.assertEquals(resp.status_int, 201)
|
||||||
@ -2295,12 +2294,11 @@ class TestObjectController(unittest.TestCase):
|
|||||||
# state.
|
# state.
|
||||||
start = time()
|
start = time()
|
||||||
orig_timestamp = utils.Timestamp(start)
|
orig_timestamp = utils.Timestamp(start)
|
||||||
|
headers = {'X-Timestamp': orig_timestamp.internal,
|
||||||
|
'Content-Type': 'application/octet-stream',
|
||||||
|
'Content-Length': '4'}
|
||||||
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
headers={
|
headers=headers)
|
||||||
'X-Timestamp': orig_timestamp.internal,
|
|
||||||
'Content-Type': 'application/octet-stream',
|
|
||||||
'Content-Length': '4',
|
|
||||||
})
|
|
||||||
req.body = 'test'
|
req.body = 'test'
|
||||||
resp = req.get_response(self.object_controller)
|
resp = req.get_response(self.object_controller)
|
||||||
self.assertEquals(resp.status_int, 201)
|
self.assertEquals(resp.status_int, 201)
|
||||||
|
@ -5763,11 +5763,10 @@ class TestObjectController(unittest.TestCase):
|
|||||||
self.assertEquals(resp.status_int // 100, 5) # server error
|
self.assertEquals(resp.status_int // 100, 5) # server error
|
||||||
|
|
||||||
# req supplies etag, object servers return 422 - mismatch
|
# req supplies etag, object servers return 422 - mismatch
|
||||||
|
headers = {'Content-Length': '0',
|
||||||
|
'ETag': '68b329da9893e34099c7d8ad5cb9c940'}
|
||||||
req = Request.blank('/v1/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/v1/a/c/o', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
headers={
|
headers=headers)
|
||||||
'Content-Length': '0',
|
|
||||||
'ETag': '68b329da9893e34099c7d8ad5cb9c940',
|
|
||||||
})
|
|
||||||
self.app.update_request(req)
|
self.app.update_request(req)
|
||||||
set_http_connect(200, 422, 422, 503,
|
set_http_connect(200, 422, 422, 503,
|
||||||
etags=['68b329da9893e34099c7d8ad5cb9c940',
|
etags=['68b329da9893e34099c7d8ad5cb9c940',
|
||||||
@ -8499,7 +8498,7 @@ class TestAccountController(unittest.TestCase):
|
|||||||
self.assert_status_map(
|
self.assert_status_map(
|
||||||
controller.POST,
|
controller.POST,
|
||||||
(404, 404, 404, 202, 202, 202, 201, 201, 201), 201)
|
(404, 404, 404, 202, 202, 202, 201, 201, 201), 201)
|
||||||
# account_info PUT account POST account
|
# account_info PUT account POST account
|
||||||
self.assert_status_map(
|
self.assert_status_map(
|
||||||
controller.POST,
|
controller.POST,
|
||||||
(404, 404, 503, 201, 201, 503, 204, 204, 504), 204)
|
(404, 404, 503, 201, 201, 503, 204, 204, 504), 204)
|
||||||
|
Loading…
Reference in New Issue
Block a user