Merge "Update hacking version"
This commit is contained in:
commit
b8c863e6bb
@ -248,8 +248,8 @@ def encode_meta_headers(headers):
|
|||||||
value = encode_utf8(value)
|
value = encode_utf8(value)
|
||||||
header = header.lower()
|
header = header.lower()
|
||||||
|
|
||||||
if (isinstance(header, six.string_types)
|
if (isinstance(header, six.string_types) and
|
||||||
and header.startswith(USER_METADATA_TYPE)):
|
header.startswith(USER_METADATA_TYPE)):
|
||||||
header = encode_utf8(header)
|
header = encode_utf8(header)
|
||||||
|
|
||||||
ret[header] = value
|
ret[header] = value
|
||||||
@ -706,9 +706,9 @@ def get_auth(auth_url, user, key, **kwargs):
|
|||||||
if kwargs.get('tenant_name'):
|
if kwargs.get('tenant_name'):
|
||||||
os_options['tenant_name'] = kwargs['tenant_name']
|
os_options['tenant_name'] = kwargs['tenant_name']
|
||||||
|
|
||||||
if not (os_options.get('tenant_name') or os_options.get('tenant_id')
|
if not (os_options.get('tenant_name') or os_options.get('tenant_id') or
|
||||||
or os_options.get('project_name')
|
os_options.get('project_name') or
|
||||||
or os_options.get('project_id')):
|
os_options.get('project_id')):
|
||||||
if auth_version in AUTH_VERSIONS_V2:
|
if auth_version in AUTH_VERSIONS_V2:
|
||||||
raise ClientException('No tenant specified')
|
raise ClientException('No tenant specified')
|
||||||
raise ClientException('No project name or project id specified.')
|
raise ClientException('No project name or project id specified.')
|
||||||
@ -1659,8 +1659,8 @@ class Connection(object):
|
|||||||
self.force_auth_retry = force_auth_retry
|
self.force_auth_retry = force_auth_retry
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
if (self.http_conn and isinstance(self.http_conn, tuple)
|
if (self.http_conn and isinstance(self.http_conn, tuple) and
|
||||||
and len(self.http_conn) > 1):
|
len(self.http_conn) > 1):
|
||||||
conn = self.http_conn[1]
|
conn = self.http_conn[1]
|
||||||
conn.close()
|
conn.close()
|
||||||
self.http_conn = None
|
self.http_conn = None
|
||||||
|
@ -424,8 +424,8 @@ class _SwiftReader(object):
|
|||||||
'{1} != {2}'.format(
|
'{1} != {2}'.format(
|
||||||
self._path, etag, self._expected_md5))
|
self._path, etag, self._expected_md5))
|
||||||
|
|
||||||
if (self._content_length is not None
|
if (self._content_length is not None and
|
||||||
and self._actual_read != self._content_length):
|
self._actual_read != self._content_length):
|
||||||
raise SwiftError('Error downloading {0}: read_length != '
|
raise SwiftError('Error downloading {0}: read_length != '
|
||||||
'content_length, {1:d} != {2:d}'.format(
|
'content_length, {1:d} != {2:d}'.format(
|
||||||
self._path, self._actual_read,
|
self._path, self._actual_read,
|
||||||
@ -1244,8 +1244,8 @@ class SwiftService(object):
|
|||||||
bytes_read = obj_body.bytes_read()
|
bytes_read = obj_body.bytes_read()
|
||||||
if fp is not None:
|
if fp is not None:
|
||||||
fp.close()
|
fp.close()
|
||||||
if ('x-object-meta-mtime' in headers and not no_file
|
if ('x-object-meta-mtime' in headers and not no_file and
|
||||||
and not options['ignore_mtime']):
|
not options['ignore_mtime']):
|
||||||
try:
|
try:
|
||||||
mtime = float(headers['x-object-meta-mtime'])
|
mtime = float(headers['x-object-meta-mtime'])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
@ -2036,8 +2036,8 @@ class SwiftService(object):
|
|||||||
new_slo_manifest_paths = set()
|
new_slo_manifest_paths = set()
|
||||||
segment_size = int(0 if options['segment_size'] is None
|
segment_size = int(0 if options['segment_size'] is None
|
||||||
else options['segment_size'])
|
else options['segment_size'])
|
||||||
if (options['changed'] or options['skip_identical']
|
if (options['changed'] or options['skip_identical'] or
|
||||||
or not options['leave_segments']):
|
not options['leave_segments']):
|
||||||
try:
|
try:
|
||||||
headers = conn.head_object(container, obj)
|
headers = conn.head_object(container, obj)
|
||||||
is_slo = config_true_value(
|
is_slo = config_true_value(
|
||||||
@ -2058,9 +2058,9 @@ class SwiftService(object):
|
|||||||
|
|
||||||
cl = int(headers.get('content-length'))
|
cl = int(headers.get('content-length'))
|
||||||
mt = headers.get('x-object-meta-mtime')
|
mt = headers.get('x-object-meta-mtime')
|
||||||
if (path is not None and options['changed']
|
if (path is not None and options['changed'] and
|
||||||
and cl == getsize(path)
|
cl == getsize(path) and
|
||||||
and mt == put_headers['x-object-meta-mtime']):
|
mt == put_headers['x-object-meta-mtime']):
|
||||||
res.update({
|
res.update({
|
||||||
'success': True,
|
'success': True,
|
||||||
'status': 'skipped-changed'
|
'status': 'skipped-changed'
|
||||||
@ -2095,8 +2095,8 @@ class SwiftService(object):
|
|||||||
# a segment job if we're reading from a stream - we may fail if we
|
# a segment job if we're reading from a stream - we may fail if we
|
||||||
# go over the single object limit, but this gives us a nice way
|
# go over the single object limit, but this gives us a nice way
|
||||||
# to create objects from memory
|
# to create objects from memory
|
||||||
if (path is not None and segment_size
|
if (path is not None and segment_size and
|
||||||
and (getsize(path) > segment_size)):
|
(getsize(path) > segment_size)):
|
||||||
res['large_object'] = True
|
res['large_object'] = True
|
||||||
seg_container = container + '_segments'
|
seg_container = container + '_segments'
|
||||||
if options['segment_container']:
|
if options['segment_container']:
|
||||||
@ -2425,8 +2425,8 @@ class SwiftService(object):
|
|||||||
|
|
||||||
# Cancel the remaining container deletes, but yield
|
# Cancel the remaining container deletes, but yield
|
||||||
# any pending results
|
# any pending results
|
||||||
if (not cancelled and options['fail_fast']
|
if (not cancelled and options['fail_fast'] and
|
||||||
and not res['success']):
|
not res['success']):
|
||||||
cancelled = True
|
cancelled = True
|
||||||
|
|
||||||
def _bulk_delete_page_size(self, objects):
|
def _bulk_delete_page_size(self, objects):
|
||||||
|
@ -1462,8 +1462,9 @@ def st_bash_completion(parser, args, thread_manager, return_parser=False):
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
fn_commands = [fn for fn in globals().keys()
|
fn_commands = [fn for fn in globals().keys()
|
||||||
if fn.startswith('st_') and not fn.endswith('_options')
|
if fn.startswith('st_') and
|
||||||
and not fn.endswith('_help')]
|
not fn.endswith('_options') and
|
||||||
|
not fn.endswith('_help')]
|
||||||
|
|
||||||
subparsers = parser.add_subparsers()
|
subparsers = parser.add_subparsers()
|
||||||
subcommands = {}
|
subcommands = {}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
hacking<0.11,>=0.10.0
|
hacking>=1.1.0,<1.2.0 # Apache-2.0
|
||||||
|
|
||||||
coverage!=4.4,>=4.0 # Apache-2.0
|
coverage!=4.4,>=4.0 # Apache-2.0
|
||||||
keystoneauth1>=3.4.0 # Apache-2.0
|
keystoneauth1>=3.4.0 # Apache-2.0
|
||||||
|
@ -1996,8 +1996,8 @@ class TestBase(unittest.TestCase):
|
|||||||
self._environ_vars = {}
|
self._environ_vars = {}
|
||||||
keys = list(os.environ.keys())
|
keys = list(os.environ.keys())
|
||||||
for k in keys:
|
for k in keys:
|
||||||
if (k in ('ST_KEY', 'ST_USER', 'ST_AUTH')
|
if (k in ('ST_KEY', 'ST_USER', 'ST_AUTH') or
|
||||||
or k.startswith('OS_')):
|
k.startswith('OS_')):
|
||||||
self._environ_vars[k] = os.environ.pop(k)
|
self._environ_vars[k] = os.environ.pop(k)
|
||||||
|
|
||||||
def _replace_swift_env_vars(self):
|
def _replace_swift_env_vars(self):
|
||||||
@ -2979,12 +2979,12 @@ class TestCrossAccountObjectAccess(TestBase, MockHttpTest):
|
|||||||
Modify response code to 200 if cross account permissions match.
|
Modify response code to 200 if cross account permissions match.
|
||||||
"""
|
"""
|
||||||
status = 403
|
status = 403
|
||||||
if (path.startswith('/v1/%s/%s' % (self.account, self.cont))
|
if (path.startswith('/v1/%s/%s' % (self.account, self.cont)) and
|
||||||
and read_ok and method in ('GET', 'HEAD')):
|
read_ok and method in ('GET', 'HEAD')):
|
||||||
status = 200
|
status = 200
|
||||||
elif (path.startswith('/v1/%s/%s%s'
|
elif (path.startswith('/v1/%s/%s%s'
|
||||||
% (self.account, self.cont, self.obj))
|
% (self.account, self.cont, self.obj)) and
|
||||||
and write_ok and method in ('PUT', 'POST', 'DELETE')):
|
write_ok and method in ('PUT', 'POST', 'DELETE')):
|
||||||
status = 200
|
status = 200
|
||||||
return status
|
return status
|
||||||
return on_request
|
return on_request
|
||||||
|
2
tox.ini
2
tox.ini
@ -77,7 +77,7 @@ commands=
|
|||||||
# H403: multi line docstrings should end on a new line
|
# H403: multi line docstrings should end on a new line
|
||||||
# H404: multi line docstring should start without a leading new line
|
# H404: multi line docstring should start without a leading new line
|
||||||
# H405: multi line docstring summary not separated with an empty line
|
# H405: multi line docstring summary not separated with an empty line
|
||||||
ignore = H101,H301,H306,H401,H403,H404,H405
|
ignore = E731,H101,H301,H306,H401,H403,H404,H405
|
||||||
show-source = True
|
show-source = True
|
||||||
exclude = .venv,.tox,dist,doc,*egg
|
exclude = .venv,.tox,dist,doc,*egg
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user