From 87a08aafd82be6588f8e3a10e3a14ca7854932a2 Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Mon, 9 Jun 2014 14:45:26 -0700 Subject: [PATCH] Cleanup and gate on pep8 rules that are stricter in hacking 0.9 Fix up pep8 failures for rules we previously gated on, but that are now stricter in there enforcement. Ignore E251 due to https://github.com/jcrocholl/pep8/issues/301 Change-Id: I62b33e97c44c4a5be436b381cfbdaeb31cd2638b --- nova/api/ec2/cloud.py | 2 +- nova/block_device.py | 4 ++-- nova/conductor/tasks/live_migrate.py | 2 +- nova/db/api.py | 2 +- nova/tests/api/ec2/test_cinder_cloud.py | 2 +- .../api/openstack/compute/contrib/test_attach_interfaces.py | 4 ++-- .../openstack/compute/plugins/v3/test_attach_interfaces.py | 4 ++-- nova/virt/disk/api.py | 2 +- tox.ini | 5 +++-- 9 files changed, 14 insertions(+), 13 deletions(-) diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index ef6a6609d996..b73ed1aabe58 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -688,7 +688,7 @@ class CloudController(object): def _get_source_project_id(self, context, source_security_group_owner_id): if source_security_group_owner_id: - # Parse user:project for source group. + # Parse user:project for source group. source_parts = source_security_group_owner_id.split(':') # If no project name specified, assume it's same as user name. diff --git a/nova/block_device.py b/nova/block_device.py index 3f34942bf530..6d955faa2267 100644 --- a/nova/block_device.py +++ b/nova/block_device.py @@ -214,8 +214,8 @@ class BlockDeviceDict(dict): legacy_block_device['virtual_name'] = None elif source_type == 'image': if destination_type != 'volume': - # NOTE(ndipanov): Image bdms with local destination - # have no meaning in the legacy format - raise + # NOTE(ndipanov): Image bdms with local destination + # have no meaning in the legacy format - raise raise exception.InvalidBDMForLegacy() legacy_block_device['virtual_name'] = None diff --git a/nova/conductor/tasks/live_migrate.py b/nova/conductor/tasks/live_migrate.py index bfd4448fc557..102ceb19baf5 100644 --- a/nova/conductor/tasks/live_migrate.py +++ b/nova/conductor/tasks/live_migrate.py @@ -61,13 +61,13 @@ class LiveMigrationTask(object): self._check_requested_destination() #TODO(johngarbutt) need to move complexity out of compute manager + #TODO(johngarbutt) disk_over_commit? return self.compute_rpcapi.live_migration(self.context, host=self.source, instance=self.instance, dest=self.destination, block_migration=self.block_migration, migrate_data=self.migrate_data) - #TODO(johngarbutt) disk_over_commit? def rollback(self): #TODO(johngarbutt) need to implement the clean up operation diff --git a/nova/db/api.py b/nova/db/api.py index a11d91213e0d..ee7ad22209f9 100644 --- a/nova/db/api.py +++ b/nova/db/api.py @@ -1457,8 +1457,8 @@ def console_get(context, console_id, instance_uuid=None): """Get a specific console (possibly on a given instance).""" return IMPL.console_get(context, console_id, instance_uuid) +################## - ################## def flavor_create(context, values, projects=None): """Create a new instance type.""" diff --git a/nova/tests/api/ec2/test_cinder_cloud.py b/nova/tests/api/ec2/test_cinder_cloud.py index 93847140b34b..600e95875adc 100644 --- a/nova/tests/api/ec2/test_cinder_cloud.py +++ b/nova/tests/api/ec2/test_cinder_cloud.py @@ -557,7 +557,7 @@ class CinderCloudTestCase(test.TestCase): 'ebs': {'status': 'attached', 'deleteOnTermination': False, 'volumeId': 'vol-0000000b', }}] - # NOTE(yamahata): swap/ephemeral device case isn't supported yet. + # NOTE(yamahata): swap/ephemeral device case isn't supported yet. _expected_instance_bdm2 = { 'instanceId': 'i-00000002', diff --git a/nova/tests/api/openstack/compute/contrib/test_attach_interfaces.py b/nova/tests/api/openstack/compute/contrib/test_attach_interfaces.py index 00789bf6c17c..02f9d2e65754 100644 --- a/nova/tests/api/openstack/compute/contrib/test_attach_interfaces.py +++ b/nova/tests/api/openstack/compute/contrib/test_attach_interfaces.py @@ -93,8 +93,8 @@ def fake_show_port(self, context, port_id, **kwargs): def fake_attach_interface(self, context, instance, network_id, port_id, requested_ip='192.168.1.3'): if not network_id: - # if no network_id is given when add a port to an instance, use the - # first default network. + # if no network_id is given when add a port to an instance, use the + # first default network. network_id = fake_networks[0] if network_id == 'bad_id': raise exception.NetworkNotFound(network_id=network_id) diff --git a/nova/tests/api/openstack/compute/plugins/v3/test_attach_interfaces.py b/nova/tests/api/openstack/compute/plugins/v3/test_attach_interfaces.py index feeb95eb9ce4..2654a56ce3e4 100644 --- a/nova/tests/api/openstack/compute/plugins/v3/test_attach_interfaces.py +++ b/nova/tests/api/openstack/compute/plugins/v3/test_attach_interfaces.py @@ -93,8 +93,8 @@ def fake_show_port(self, context, port_id, **kwargs): def fake_attach_interface(self, context, instance, network_id, port_id, requested_ip='192.168.1.3'): if not network_id: - # if no network_id is given when add a port to an instance, use the - # first default network. + # if no network_id is given when add a port to an instance, use the + # first default network. network_id = fake_networks[0] if network_id == 'bad_id': raise exception.NetworkNotFound(network_id=network_id) diff --git a/nova/virt/disk/api.py b/nova/virt/disk/api.py index 034437a718fc..3758a748f511 100644 --- a/nova/virt/disk/api.py +++ b/nova/virt/disk/api.py @@ -627,7 +627,7 @@ def _set_passwd(username, admin_passwd, passwd_data, shadow_data): p_file = passwd_data.split("\n") s_file = shadow_data.split("\n") - # username MUST exist in passwd file or it's an error + # username MUST exist in passwd file or it's an error found = False for entry in p_file: split_entry = entry.split(':') diff --git a/tox.ini b/tox.ini index 6fd13460c9d7..7c4525017cd4 100644 --- a/tox.ini +++ b/tox.ini @@ -58,9 +58,10 @@ sitepackages = False # E125 is deliberately excluded. See https://github.com/jcrocholl/pep8/issues/126 # The rest of the ignores are TODOs # New from hacking 0.9: E129, E131, E265, E713, H407, H405, H904 -# Stricter in hacking 0.9: E111, E112, E113, E251, E303, F402, F812 +# Stricter in hacking 0.9: F402, F812 +# E251 Skipped due to https://github.com/jcrocholl/pep8/issues/301 -ignore = E111,E112,E113,E121,E122,E123,E124,E125,E129,E126,E127,E128,E131,E251,E265,E303,E711,E712,E713,F811,F402,F812,H305,H307,H405,H803,H904 +ignore = E121,E122,E123,E124,E125,E129,E126,E127,E128,E131,E251,E265,E711,E712,E713,F811,F402,F812,H305,H307,H405,H803,H904 exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools [hacking]