Fix a few minor annoyances that snuck in
We had the normal infra pep8 ignores marked, but follow some of them by hand in this codebase anyway. While E12* are not valid pep8, the prevailing style of shade is in agreement with them. While we weren't enforcing them, a few instances snuck in. Fix them and just turn the flags on. Change-Id: Iea2bd9a99eb8b20dd40418ac8479b809d3872de8
This commit is contained in:
parent
8aa8688ba8
commit
c9e9ef9f43
@ -2121,8 +2121,7 @@ class OpenStackCloud(_normalize.Normalizer):
|
|||||||
external_ipv4_networks.append(network)
|
external_ipv4_networks.append(network)
|
||||||
|
|
||||||
# External Floating IPv4 networks
|
# External Floating IPv4 networks
|
||||||
if ('router:external' in network
|
if ('router:external' in network and network['router:external']):
|
||||||
and network['router:external']):
|
|
||||||
external_ipv4_floating_networks.append(network)
|
external_ipv4_floating_networks.append(network)
|
||||||
|
|
||||||
# Internal networks
|
# Internal networks
|
||||||
@ -3016,7 +3015,7 @@ class OpenStackCloud(_normalize.Normalizer):
|
|||||||
if interface_type:
|
if interface_type:
|
||||||
filtered_ports = []
|
filtered_ports = []
|
||||||
if (router.get('external_gateway_info') and
|
if (router.get('external_gateway_info') and
|
||||||
'external_fixed_ips' in router['external_gateway_info']):
|
'external_fixed_ips' in router['external_gateway_info']):
|
||||||
ext_fixed = \
|
ext_fixed = \
|
||||||
router['external_gateway_info']['external_fixed_ips']
|
router['external_gateway_info']['external_fixed_ips']
|
||||||
else:
|
else:
|
||||||
@ -4013,7 +4012,7 @@ class OpenStackCloud(_normalize.Normalizer):
|
|||||||
for count in _utils._iterate_timeout(
|
for count in _utils._iterate_timeout(
|
||||||
timeout,
|
timeout,
|
||||||
"Timeout waiting for the volume snapshot to be available."
|
"Timeout waiting for the volume snapshot to be available."
|
||||||
):
|
):
|
||||||
snapshot = self.get_volume_snapshot_by_id(snapshot_id)
|
snapshot = self.get_volume_snapshot_by_id(snapshot_id)
|
||||||
|
|
||||||
if snapshot['status'] == 'available':
|
if snapshot['status'] == 'available':
|
||||||
@ -5862,7 +5861,7 @@ class OpenStackCloud(_normalize.Normalizer):
|
|||||||
return segment_size
|
return segment_size
|
||||||
|
|
||||||
def is_object_stale(
|
def is_object_stale(
|
||||||
self, container, name, filename, file_md5=None, file_sha256=None):
|
self, container, name, filename, file_md5=None, file_sha256=None):
|
||||||
|
|
||||||
metadata = self.get_object_metadata(container, name)
|
metadata = self.get_object_metadata(container, name)
|
||||||
if not metadata:
|
if not metadata:
|
||||||
@ -5998,7 +5997,8 @@ class OpenStackCloud(_normalize.Normalizer):
|
|||||||
entry['etag'] = result.headers['Etag']
|
entry['etag'] = result.headers['Etag']
|
||||||
|
|
||||||
def _upload_large_object(
|
def _upload_large_object(
|
||||||
self, endpoint, filename, headers, file_size, segment_size, use_slo):
|
self, endpoint, filename,
|
||||||
|
headers, file_size, segment_size, use_slo):
|
||||||
# If the object is big, we need to break it up into segments that
|
# If the object is big, we need to break it up into segments that
|
||||||
# are no larger than segment_size, upload each of them individually
|
# are no larger than segment_size, upload each of them individually
|
||||||
# and then upload a manifest object. The segments can be uploaded in
|
# and then upload a manifest object. The segments can be uploaded in
|
||||||
|
@ -1150,7 +1150,7 @@ class OperatorCloud(openstackcloud.OpenStackCloud):
|
|||||||
domain_id = dom['id']
|
domain_id = dom['id']
|
||||||
|
|
||||||
with _utils.shade_exceptions(
|
with _utils.shade_exceptions(
|
||||||
"Failed to delete domain {id}".format(id=domain_id)):
|
"Failed to delete domain {id}".format(id=domain_id)):
|
||||||
# Deleting a domain is expensive, so disabling it first increases
|
# Deleting a domain is expensive, so disabling it first increases
|
||||||
# the changes of success
|
# the changes of success
|
||||||
domain = self.update_domain(domain_id, enabled=False)
|
domain = self.update_domain(domain_id, enabled=False)
|
||||||
|
@ -103,8 +103,8 @@ class TestEndpoints(base.BaseFunctionalTestCase):
|
|||||||
self.assertIsNotNone(endpoints[0].get('id'))
|
self.assertIsNotNone(endpoints[0].get('id'))
|
||||||
|
|
||||||
def test_update_endpoint(self):
|
def test_update_endpoint(self):
|
||||||
if self.operator_cloud.cloud_config.get_api_version(
|
ver = self.operator_cloud.cloud_config.get_api_version('identity')
|
||||||
'identity').startswith('2'):
|
if ver.startswith('2'):
|
||||||
# NOTE(SamYaple): Update endpoint only works with v3 api
|
# NOTE(SamYaple): Update endpoint only works with v3 api
|
||||||
self.assertRaises(OpenStackCloudUnavailableFeature,
|
self.assertRaises(OpenStackCloudUnavailableFeature,
|
||||||
self.operator_cloud.update_endpoint,
|
self.operator_cloud.update_endpoint,
|
||||||
|
@ -66,8 +66,7 @@ class TestObject(base.BaseFunctionalTestCase):
|
|||||||
self.assertFalse(self.user_cloud.is_object_stale(
|
self.assertFalse(self.user_cloud.is_object_stale(
|
||||||
container_name, name,
|
container_name, name,
|
||||||
fake_file.name
|
fake_file.name
|
||||||
)
|
))
|
||||||
)
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
'bar', self.user_cloud.get_object_metadata(
|
'bar', self.user_cloud.get_object_metadata(
|
||||||
container_name, name)['x-object-meta-foo']
|
container_name, name)['x-object-meta-foo']
|
||||||
@ -131,8 +130,7 @@ class TestObject(base.BaseFunctionalTestCase):
|
|||||||
self.assertFalse(self.user_cloud.is_object_stale(
|
self.assertFalse(self.user_cloud.is_object_stale(
|
||||||
container_name, name,
|
container_name, name,
|
||||||
fake_file.name
|
fake_file.name
|
||||||
)
|
))
|
||||||
)
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
'bar', self.user_cloud.get_object_metadata(
|
'bar', self.user_cloud.get_object_metadata(
|
||||||
container_name, name)['x-object-meta-foo']
|
container_name, name)['x-object-meta-foo']
|
||||||
|
@ -65,8 +65,8 @@ class TestServices(base.BaseFunctionalTestCase):
|
|||||||
self.assertIsNotNone(service.get('id'))
|
self.assertIsNotNone(service.get('id'))
|
||||||
|
|
||||||
def test_update_service(self):
|
def test_update_service(self):
|
||||||
if self.operator_cloud.cloud_config.get_api_version(
|
ver = self.operator_cloud.cloud_config.get_api_version('identity')
|
||||||
'identity').startswith('2'):
|
if ver.startswith('2'):
|
||||||
# NOTE(SamYaple): Update service only works with v3 api
|
# NOTE(SamYaple): Update service only works with v3 api
|
||||||
self.assertRaises(OpenStackCloudUnavailableFeature,
|
self.assertRaises(OpenStackCloudUnavailableFeature,
|
||||||
self.operator_cloud.update_service,
|
self.operator_cloud.update_service,
|
||||||
|
@ -98,7 +98,7 @@ class TestUtils(base.TestCase):
|
|||||||
data, u'中文',
|
data, u'中文',
|
||||||
{'other': {
|
{'other': {
|
||||||
'financial': {'status': 'rich'}
|
'financial': {'status': 'rich'}
|
||||||
}})
|
}})
|
||||||
self.assertEqual([el2], ret)
|
self.assertEqual([el2], ret)
|
||||||
|
|
||||||
def test__filter_list_filter(self):
|
def test__filter_list_filter(self):
|
||||||
@ -139,7 +139,7 @@ class TestUtils(base.TestCase):
|
|||||||
data, 'donald',
|
data, 'donald',
|
||||||
{'other': {
|
{'other': {
|
||||||
'financial': {'status': 'rich'}
|
'financial': {'status': 'rich'}
|
||||||
}})
|
}})
|
||||||
self.assertEqual([el2, el3], ret)
|
self.assertEqual([el2, el3], ret)
|
||||||
|
|
||||||
def test_safe_dict_min_ints(self):
|
def test_safe_dict_min_ints(self):
|
||||||
|
3
tox.ini
3
tox.ini
@ -67,10 +67,9 @@ commands = python setup.py build_sphinx
|
|||||||
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
# Infra does not follow hacking, nor the broken E12* things
|
|
||||||
# The string of H ignores is because there are some useful checks
|
# The string of H ignores is because there are some useful checks
|
||||||
# related to python3 compat.
|
# related to python3 compat.
|
||||||
ignore = E123,E125,E129,H3,H4,H5,H6,H7,H8,H103,H201,H238
|
ignore = H3,H4,H5,H6,H7,H8,H103,H201,H238
|
||||||
show-source = True
|
show-source = True
|
||||||
builtins = _
|
builtins = _
|
||||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
||||||
|
Loading…
x
Reference in New Issue
Block a user