Merge "E128 ignore statement make code unclearly"

This commit is contained in:
Jenkins 2017-02-13 14:30:43 +00:00 committed by Gerrit Code Review
commit 9583a26274
6 changed files with 42 additions and 33 deletions

View File

@ -32,14 +32,15 @@ class SegmentationDriver(object):
self.available_local_vlans.remove(allocated) self.available_local_vlans.remove(allocated)
return allocated return allocated
except IndexError: except IndexError:
raise exceptions.SegmentationIdAllocationFailure('There are ' raise exceptions.SegmentationIdAllocationFailure(
'no vlan ids available.') 'There are no vlan ids available.')
except KeyError: except KeyError:
# Other thread obtained the same vlan_id, so a new try is # Other thread obtained the same vlan_id, so a new try is
# needed # needed
continue continue
raise exceptions.SegmentationIdAllocationFailure('Max number of ' raise exceptions.SegmentationIdAllocationFailure(
'retries reached without finding an available vlan id.') 'Max number of retries reached without '
'finding an available vlan id.')
def release_segmentation_id(self, id): def release_segmentation_id(self, id):
self.available_local_vlans.add(id) self.available_local_vlans.add(id)

View File

@ -77,8 +77,12 @@ def get_dict_format_fixed_ips_from_kv_format(fixed_ips):
subnet_id = fixed_ip.split('=')[1] subnet_id = fixed_ip.split('=')[1]
else: else:
ip = fixed_ip.split('=')[1] ip = fixed_ip.split('=')[1]
new_fixed_ips.append({'subnet_id': subnet_id, new_fixed_ips.append(
'ip_address': ip}) {
'subnet_id': subnet_id,
'ip_address': ip
}
)
return new_fixed_ips return new_fixed_ips

View File

@ -52,7 +52,8 @@ class TestCase(base.BaseTestCase):
# http://developer.openstack.org/api-ref-networking-v2.html#createSubnet # noqa # http://developer.openstack.org/api-ref-networking-v2.html#createSubnet # noqa
fake_subnet_response = { fake_subnet_response = {
"subnets": [ "subnets": [
{"name": '-'.join([docker_endpoint_id, '192.168.1.0']), {
"name": '-'.join([docker_endpoint_id, '192.168.1.0']),
"network_id": neutron_network_id, "network_id": neutron_network_id,
"tenant_id": "c1210485b2424d48804aad5d39c61b8f", "tenant_id": "c1210485b2424d48804aad5d39c61b8f",
"allocation_pools": [{"start": "192.168.1.2", "allocation_pools": [{"start": "192.168.1.2",
@ -62,8 +63,10 @@ class TestCase(base.BaseTestCase):
"cidr": "192.168.1.0/24", "cidr": "192.168.1.0/24",
"id": fake_neutron_subnet_v4_id, "id": fake_neutron_subnet_v4_id,
"enable_dhcp": True, "enable_dhcp": True,
"subnetpool_id": ''}, "subnetpool_id": ''
{"name": '-'.join([docker_endpoint_id, 'fe80::']), },
{
"name": '-'.join([docker_endpoint_id, 'fe80::']),
"network_id": neutron_network_id, "network_id": neutron_network_id,
"tenant_id": "c1210485b2424d48804aad5d39c61b8f", "tenant_id": "c1210485b2424d48804aad5d39c61b8f",
"allocation_pools": [{"start": "fe80::f816:3eff:fe20:57c4", "allocation_pools": [{"start": "fe80::f816:3eff:fe20:57c4",
@ -73,7 +76,8 @@ class TestCase(base.BaseTestCase):
"cidr": "fe80::/64", "cidr": "fe80::/64",
"id": fake_neutron_subnet_v6_id, "id": fake_neutron_subnet_v6_id,
"enable_dhcp": True, "enable_dhcp": True,
"subnetpool_id": ''} "subnetpool_id": ''
}
] ]
} }
return fake_subnet_response return fake_subnet_response

View File

@ -102,5 +102,6 @@ class TestKuryrUtils(base.TestCase):
def test_get_random_string(self): def test_get_random_string(self):
fake_string_len = 20 fake_string_len = 20
self.assertEqual(fake_string_len, self.assertEqual(
fake_string_len,
len(utils.get_random_string(fake_string_len))) len(utils.get_random_string(fake_string_len)))

View File

@ -53,11 +53,10 @@ commands = python setup.py build_sphinx
[flake8] [flake8]
# E125 continuation line does not distinguish itself from next logical line # E125 continuation line does not distinguish itself from next logical line
# E126 continuation line over-indented for hanging indent # E126 continuation line over-indented for hanging indent
# E128 continuation line under-indented for visual indent
# E129 visually indented line with same indent as next logical line # E129 visually indented line with same indent as next logical line
# E265 block comment should start with '# ' # E265 block comment should start with '# '
# N530 direct neutron imports not allowed # N530 direct neutron imports not allowed
ignore = E125,E126,E128,E129,E265,H301,N530 ignore = E125,E126,E129,E265,H301,N530
show-source = true show-source = true
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios,releasenotes exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios,releasenotes