From: Dirk Mueller Date: Tue, 27 Aug 2013 20:43:38 +0000 (+0200) Subject: Enable gating on F811 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=cf6db825031cba6089ff43d3d0cfe1fd0b59c850;p=openstack-build%2Fcinder-build.git Enable gating on F811 Avoid name clashes of local variables with imported modules. Change-Id: I1c5508902f89ad5dd9d160a4d163cd91bec41333 --- diff --git a/cinder/api/v1/volumes.py b/cinder/api/v1/volumes.py index 969655b47..df92892b0 100644 --- a/cinder/api/v1/volumes.py +++ b/cinder/api/v1/volumes.py @@ -26,7 +26,7 @@ from cinder import exception from cinder.openstack.common import log as logging from cinder.openstack.common import uuidutils from cinder import utils -from cinder import volume +from cinder import volume as cinder_volume from cinder.volume import volume_types @@ -212,7 +212,7 @@ class VolumeController(wsgi.Controller): _visible_admin_metadata_keys = ['readonly', 'attached_mode'] def __init__(self, ext_mgr): - self.volume_api = volume.API() + self.volume_api = cinder_volume.API() self.ext_mgr = ext_mgr super(VolumeController, self).__init__() diff --git a/cinder/api/v2/volumes.py b/cinder/api/v2/volumes.py index 6ef87b0a4..29b8d59bb 100644 --- a/cinder/api/v2/volumes.py +++ b/cinder/api/v2/volumes.py @@ -28,7 +28,7 @@ from cinder import exception from cinder.openstack.common import log as logging from cinder.openstack.common import uuidutils from cinder import utils -from cinder import volume +from cinder import volume as cinder_volume from cinder.volume import volume_types @@ -155,7 +155,7 @@ class VolumeController(wsgi.Controller): _visible_admin_metadata_keys = ['readonly', 'attached_mode'] def __init__(self, ext_mgr): - self.volume_api = volume.API() + self.volume_api = cinder_volume.API() self.ext_mgr = ext_mgr super(VolumeController, self).__init__() diff --git a/cinder/tests/keymgr/test_mock_key_mgr.py b/cinder/tests/keymgr/test_mock_key_mgr.py index a54262093..0cfdc0519 100644 --- a/cinder/tests/keymgr/test_mock_key_mgr.py +++ b/cinder/tests/keymgr/test_mock_key_mgr.py @@ -22,7 +22,7 @@ import array from cinder import context from cinder import exception -from cinder.keymgr import key +from cinder.keymgr import key as keymgr_key from cinder.tests.keymgr import mock_key_mgr from cinder.tests.keymgr import test_key_mgr @@ -54,9 +54,8 @@ class MockKeyManagerTestCase(test_key_mgr.KeyManagerTestCase): self.key_mgr.create_key, None) def test_store_key(self): - _key = key.SymmetricKey('AES', - array.array('B', - ('0' * 64).decode('hex')).tolist()) + secret_key = array.array('B', ('0' * 64).decode('hex')).tolist() + _key = keymgr_key.SymmetricKey('AES', secret_key) key_id = self.key_mgr.store_key(self.ctxt, _key) actual_key = self.key_mgr.get_key(self.ctxt, key_id) diff --git a/cinder/tests/test_netapp_ssc.py b/cinder/tests/test_netapp_ssc.py index 12d6553b6..860f7b252 100644 --- a/cinder/tests/test_netapp_ssc.py +++ b/cinder/tests/test_netapp_ssc.py @@ -98,8 +98,8 @@ class FakeDirectCMODEServerHandler(FakeHTTPRequestHandler): body = [x for x in root.iterchildren()] request = body[0] tag = request.tag - api = etree.QName(tag).localname or tag - if 'volume-get-iter' == api: + localname = etree.QName(tag).localname or tag + if 'volume-get-iter' == localname: body = """ @@ -208,7 +208,7 @@ class FakeDirectCMODEServerHandler(FakeHTTPRequestHandler): 4""" - elif 'aggr-options-list-info' == api: + elif 'aggr-options-list-info' == localname: body = """ @@ -221,7 +221,7 @@ class FakeDirectCMODEServerHandler(FakeHTTPRequestHandler): """ - elif 'sis-get-iter' == api: + elif 'sis-get-iter' == localname: body = """ @@ -233,7 +233,7 @@ class FakeDirectCMODEServerHandler(FakeHTTPRequestHandler): """ - elif 'storage-disk-get-iter' == api: + elif 'storage-disk-get-iter' == localname: body = """ @@ -373,7 +373,6 @@ class SscUtilsTestCase(test.TestCase): def test_cl_vols_ssc_all(self): """Test cluster ssc for all vols.""" - mox = self.mox na_server = api.NaServer('127.0.0.1') vserver = 'openstack' test_vols = set([copy.deepcopy(self.vol1), @@ -381,10 +380,10 @@ class SscUtilsTestCase(test.TestCase): sis = {'vola': {'dedup': False, 'compression': False}, 'volb': {'dedup': True, 'compression': False}} - mox.StubOutWithMock(ssc_utils, 'query_cluster_vols_for_ssc') - mox.StubOutWithMock(ssc_utils, 'get_sis_vol_dict') - mox.StubOutWithMock(ssc_utils, 'query_aggr_options') - mox.StubOutWithMock(ssc_utils, 'query_aggr_storage_disk') + self.mox.StubOutWithMock(ssc_utils, 'query_cluster_vols_for_ssc') + self.mox.StubOutWithMock(ssc_utils, 'get_sis_vol_dict') + self.mox.StubOutWithMock(ssc_utils, 'query_aggr_options') + self.mox.StubOutWithMock(ssc_utils, 'query_aggr_storage_disk') ssc_utils.query_cluster_vols_for_ssc( na_server, vserver, None).AndReturn(test_vols) ssc_utils.get_sis_vol_dict(na_server, vserver, None).AndReturn(sis) @@ -398,12 +397,12 @@ class SscUtilsTestCase(test.TestCase): na_server, IgnoreArg()).AndReturn(raid4) ssc_utils.query_aggr_storage_disk( na_server, IgnoreArg()).AndReturn('SAS') - mox.ReplayAll() + self.mox.ReplayAll() res_vols = ssc_utils.get_cluster_vols_with_ssc( na_server, vserver, volume=None) - mox.VerifyAll() + self.mox.VerifyAll() for vol in res_vols: if vol.id['name'] == 'volc': self.assertEqual(vol.sis['compression'], False) @@ -413,16 +412,15 @@ class SscUtilsTestCase(test.TestCase): def test_cl_vols_ssc_single(self): """Test cluster ssc for single vol.""" - mox = self.mox na_server = api.NaServer('127.0.0.1') vserver = 'openstack' test_vols = set([copy.deepcopy(self.vol1)]) sis = {'vola': {'dedup': False, 'compression': False}} - mox.StubOutWithMock(ssc_utils, 'query_cluster_vols_for_ssc') - mox.StubOutWithMock(ssc_utils, 'get_sis_vol_dict') - mox.StubOutWithMock(ssc_utils, 'query_aggr_options') - mox.StubOutWithMock(ssc_utils, 'query_aggr_storage_disk') + self.mox.StubOutWithMock(ssc_utils, 'query_cluster_vols_for_ssc') + self.mox.StubOutWithMock(ssc_utils, 'get_sis_vol_dict') + self.mox.StubOutWithMock(ssc_utils, 'query_aggr_options') + self.mox.StubOutWithMock(ssc_utils, 'query_aggr_storage_disk') ssc_utils.query_cluster_vols_for_ssc( na_server, vserver, 'vola').AndReturn(test_vols) ssc_utils.get_sis_vol_dict( @@ -431,30 +429,29 @@ class SscUtilsTestCase(test.TestCase): ssc_utils.query_aggr_options( na_server, 'aggr1').AndReturn(raiddp) ssc_utils.query_aggr_storage_disk(na_server, 'aggr1').AndReturn('SSD') - mox.ReplayAll() + self.mox.ReplayAll() res_vols = ssc_utils.get_cluster_vols_with_ssc( na_server, vserver, volume='vola') - mox.VerifyAll() + self.mox.VerifyAll() self.assertEqual(len(res_vols), 1) def test_get_cluster_ssc(self): """Test get cluster ssc map.""" - mox = self.mox na_server = api.NaServer('127.0.0.1') vserver = 'openstack' test_vols = set( [self.vol1, self.vol2, self.vol3, self.vol4, self.vol5]) - mox.StubOutWithMock(ssc_utils, 'get_cluster_vols_with_ssc') + self.mox.StubOutWithMock(ssc_utils, 'get_cluster_vols_with_ssc') ssc_utils.get_cluster_vols_with_ssc( na_server, vserver).AndReturn(test_vols) - mox.ReplayAll() + self.mox.ReplayAll() res_map = ssc_utils.get_cluster_ssc(na_server, vserver) - mox.VerifyAll() + self.mox.VerifyAll() self.assertEqual(len(res_map['mirrored']), 1) self.assertEqual(len(res_map['dedup']), 3) self.assertEqual(len(res_map['compression']), 1) diff --git a/cinder/volume/flows/create_volume/__init__.py b/cinder/volume/flows/create_volume/__init__.py index f9227f329..f07743565 100644 --- a/cinder/volume/flows/create_volume/__init__.py +++ b/cinder/volume/flows/create_volume/__init__.py @@ -829,7 +829,7 @@ class OnFailureRescheduleTask(base.CinderTask): ] def _is_reschedulable(self, cause): - (exc_type, value, traceback) = cause.exc_info + exc_type, value = cause.exc_info()[:2] if not exc_type and cause.exc: exc_type = type(cause.exc) if not exc_type: diff --git a/tox.ini b/tox.ini index 29cbcc513..0ed6211bb 100644 --- a/tox.ini +++ b/tox.ini @@ -44,6 +44,6 @@ commands = commands = {posargs} [flake8] -ignore = E711,E712,F401,F403,F811,F841,H302,H303,H304,H402,H404 +ignore = E711,E712,F401,F403,F841,H302,H303,H304,H402,H404 builtins = _ exclude = .git,.venv,.tox,dist,doc,common,*egg,build