From bcb6f07df8dfaa86e96ab09f57eab78c3735c6f6 Mon Sep 17 00:00:00 2001 From: Martin Oemke Date: Wed, 27 Jan 2016 21:09:42 +0100 Subject: [PATCH] Fix pep8 errors in tacker code This Patch fixes pep8 errors and enables this tests for all new patches to tacker. E125 continuation line does not distinguish itself from next logical line E126 continuation line over-indented for hanging indent E129 visually indented line with same indent as next logical line H302 import only modules H904 Wrap long lines in parentheses instead of a backslash see OpenStack Style Guidelines http://docs.openstack.org/developer/hacking/ Change-Id: I29e8ac8e6cfcd547e9bdab599635d07f0df6e3d6 Related-Bug: 1515930 --- tacker/api/api_common.py | 2 +- tacker/api/v1/base.py | 16 +++++----- tacker/common/clients.py | 14 ++++----- tacker/common/rpc.py | 4 +-- tacker/db/db_base.py | 2 +- .../5958429bcb3c_modify_datatype_of_value.py | 2 +- tacker/db/migration/cli.py | 2 +- tacker/db/vm/vm_db.py | 6 ++-- tacker/tests/functional/vnfm/base.py | 29 ++++++++++--------- tacker/tests/functional/vnfm/test_vnf.py | 7 +++-- .../functional/vnfm/test_vnf_multiple_vdu.py | 2 +- .../tests/functional/vnfm/test_vnfm_param.py | 11 +++---- tacker/tests/unit/test_wsgi.py | 2 +- .../http_ping/test_http_ping.py | 2 +- .../unit/vm/monitor_drivers/ping/test_ping.py | 10 +++---- tacker/tests/unit/vm/test_monitor.py | 2 +- tacker/vm/drivers/heat/heat.py | 11 +++---- tacker/vm/drivers/nova/nova.py | 6 ++-- tacker/vm/mgmt_drivers/openwrt/openwrt.py | 2 +- tacker/vm/monitor.py | 18 ++++++------ tacker/vm/monitor_drivers/ping/ping.py | 8 ++--- tacker/vm/plugin.py | 6 ++-- tacker/wsgi.py | 8 ++--- tox.ini | 7 +---- 24 files changed, 90 insertions(+), 89 deletions(-) diff --git a/tacker/api/api_common.py b/tacker/api/api_common.py index 4847d16fa..76993d555 100644 --- a/tacker/api/api_common.py +++ b/tacker/api/api_common.py @@ -92,7 +92,7 @@ def get_limit_and_marker(request): def _get_pagination_max_limit(): max_limit = -1 if (cfg.CONF.pagination_max_limit.lower() != - constants.PAGINATION_INFINITE): + constants.PAGINATION_INFINITE): try: max_limit = int(cfg.CONF.pagination_max_limit) if max_limit == 0: diff --git a/tacker/api/v1/base.py b/tacker/api/v1/base.py index 69e11f480..9e82a2ed2 100644 --- a/tacker/api/v1/base.py +++ b/tacker/api/v1/base.py @@ -127,9 +127,9 @@ class Controller(object): context, '%s:%s' % (self._plugin_handlers[self.SHOW], attr_name), data, - might_not_exist=True): - # this attribute is visible, check next one - continue + might_not_exist=True): + # this attribute is visible, check next one + continue # if the code reaches this point then either the policy check # failed or the attribute was not visible in the first place attributes_to_exclude.append(attr_name) @@ -535,10 +535,10 @@ class Controller(object): for attr, attr_vals in attr_info.iteritems(): if attr_vals['allow_post']: if ('default' not in attr_vals and - attr not in res_dict): - msg = _("Failed to parse request. Required " - "attribute '%s' not specified") % attr - raise webob.exc.HTTPBadRequest(msg) + attr not in res_dict): + msg = _("Failed to parse request. Required " + "attribute '%s' not specified") % attr + raise webob.exc.HTTPBadRequest(msg) res_dict[attr] = res_dict.get(attr, attr_vals.get('default')) else: @@ -553,7 +553,7 @@ class Controller(object): for attr, attr_vals in attr_info.iteritems(): if (attr not in res_dict or - res_dict[attr] is attributes.ATTR_NOT_SPECIFIED): + res_dict[attr] is attributes.ATTR_NOT_SPECIFIED): continue # Convert values if necessary if 'convert_to' in attr_vals: diff --git a/tacker/common/clients.py b/tacker/common/clients.py index 8d8eb43b5..e492b5673 100644 --- a/tacker/common/clients.py +++ b/tacker/common/clients.py @@ -20,9 +20,9 @@ CONF = cfg.CONF OPTS = [ cfg.StrOpt('heat_uri', - default='http://localhost:8004/v1', - help=_("Heat service URI to create VNF resources" - "specified in the VNFD templates")), + default='http://localhost:8004/v1', + help=_("Heat service URI to create VNF resources" + "specified in the VNFD templates")), ] CONF.register_opts(OPTS, group='tacker_heat') @@ -41,10 +41,10 @@ class OpenstackClients(object): def _keystone_client(self): return ks_client.Client( - tenant_name=self.auth_tenant_name, - username=self.auth_username, - password=self.auth_password, - auth_url=self.auth_url) + tenant_name=self.auth_tenant_name, + username=self.auth_username, + password=self.auth_password, + auth_url=self.auth_url) def _heat_client(self): tenant_id = self.auth_token['tenant_id'] diff --git a/tacker/common/rpc.py b/tacker/common/rpc.py index 2ec5c7a01..49b891cf7 100644 --- a/tacker/common/rpc.py +++ b/tacker/common/rpc.py @@ -52,8 +52,8 @@ def init(conf): global TRANSPORT, NOTIFIER exmods = get_allowed_exmods() TRANSPORT = oslo_messaging.get_transport(conf, - allowed_remote_exmods=exmods, - aliases=TRANSPORT_ALIASES) + allowed_remote_exmods=exmods, + aliases=TRANSPORT_ALIASES) NOTIFIER = oslo_messaging.Notifier(TRANSPORT) diff --git a/tacker/db/db_base.py b/tacker/db/db_base.py index 7b1d817a5..eafd6aaf4 100644 --- a/tacker/db/db_base.py +++ b/tacker/db/db_base.py @@ -147,7 +147,7 @@ class CommonDbMixin(object): def _apply_dict_extend_functions(self, resource_type, response, db_object): for func in self._dict_extend_functions.get( - resource_type, []): + resource_type, []): args = (response, db_object) if isinstance(func, basestring): func = getattr(self, func, None) diff --git a/tacker/db/migration/alembic_migrations/versions/5958429bcb3c_modify_datatype_of_value.py b/tacker/db/migration/alembic_migrations/versions/5958429bcb3c_modify_datatype_of_value.py index c2dd3dc4e..67a3d4020 100644 --- a/tacker/db/migration/alembic_migrations/versions/5958429bcb3c_modify_datatype_of_value.py +++ b/tacker/db/migration/alembic_migrations/versions/5958429bcb3c_modify_datatype_of_value.py @@ -31,4 +31,4 @@ import sqlalchemy as sa def upgrade(active_plugins=None, options=None): op.alter_column('devicetemplateattributes', - 'value', type_=sa.TEXT(65535), nullable=True) + 'value', type_=sa.TEXT(65535), nullable=True) diff --git a/tacker/db/migration/cli.py b/tacker/db/migration/cli.py index 35b055320..d4915b567 100644 --- a/tacker/db/migration/cli.py +++ b/tacker/db/migration/cli.py @@ -88,7 +88,7 @@ def validate_head_file(config): head_path = os.path.join(script.versions, HEAD_FILENAME) if (os.path.isfile(head_path) and - open(head_path).read().strip() == script.get_current_head()): + open(head_path).read().strip() == script.get_current_head()): return else: alembic_util.err(_('HEAD file does not match migration timeline head')) diff --git a/tacker/db/vm/vm_db.py b/tacker/db/vm/vm_db.py index 2cafb8e1b..660455b9f 100644 --- a/tacker/db/vm/vm_db.py +++ b/tacker/db/vm/vm_db.py @@ -323,8 +323,8 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin): def _device_attribute_update_or_create( self, context, device_id, key, value): arg = (self._model_query(context, DeviceAttribute). - filter(DeviceAttribute.device_id == device_id). - filter(DeviceAttribute.key == key).first()) + filter(DeviceAttribute.device_id == device_id). + filter(DeviceAttribute.key == key).first()) if arg: arg.value = value else: @@ -482,7 +482,7 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin): def get_devices(self, context, filters=None, fields=None): devices = self._get_collection(context, Device, self._make_device_dict, - filters=filters, fields=fields) + filters=filters, fields=fields) # Ugly hack to mask internaly used record return [device for device in devices if uuidutils.is_uuid_like(device['id'])] diff --git a/tacker/tests/functional/vnfm/base.py b/tacker/tests/functional/vnfm/base.py index eea91b4ed..7387f7acd 100644 --- a/tacker/tests/functional/vnfm/base.py +++ b/tacker/tests/functional/vnfm/base.py @@ -62,8 +62,8 @@ class BaseTackerTest(base.TestCase): tenant_name = cfg.CONF.keystone_authtoken.project_name auth_uri = cfg.CONF.keystone_authtoken.auth_uri + '/v2.0' return tacker_client.Client(username=username, password=password, - tenant_name=tenant_name, - auth_url=auth_uri) + tenant_name=tenant_name, + auth_url=auth_uri) @classmethod def wait_until_vnf_status(cls, vnf_id, target_status, timeout, @@ -72,8 +72,8 @@ class BaseTackerTest(base.TestCase): while True: vnf_result = cls.client.show_vnf(vnf_id) status = vnf_result['vnf']['status'] - if (status == target_status) or ((int(time.time()) - - start_time) > timeout): + if (status == target_status) or ( + (int(time.time()) - start_time) > timeout): break time.sleep(sleep_interval) @@ -99,19 +99,22 @@ class BaseTackerTest(base.TestCase): def verify_vnf_restart(self, vnfd_instance, vnf_instance): vnf_id = vnf_instance['vnf']['id'] - vnf_current_status = self.wait_until_vnf_active(vnf_id, - constants.VNF_CIRROS_CREATE_TIMEOUT, - constants.ACTIVE_SLEEP_TIME) + vnf_current_status = self.wait_until_vnf_active( + vnf_id, + constants.VNF_CIRROS_CREATE_TIMEOUT, + constants.ACTIVE_SLEEP_TIME) self.assertEqual(vnf_current_status, 'ACTIVE') self.validate_vnf_instance(vnfd_instance, vnf_instance) self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf']['mgmt_url']) - vnf_current_status = self.wait_until_vnf_dead(vnf_id, - constants.VNF_CIRROS_DEAD_TIMEOUT, - constants.DEAD_SLEEP_TIME) + vnf_current_status = self.wait_until_vnf_dead( + vnf_id, + constants.VNF_CIRROS_DEAD_TIMEOUT, + constants.DEAD_SLEEP_TIME) self.assertEqual(vnf_current_status, 'DEAD') - vnf_current_status = self.wait_until_vnf_active(vnf_id, - constants.VNF_CIRROS_CREATE_TIMEOUT, - constants.ACTIVE_SLEEP_TIME) + vnf_current_status = self.wait_until_vnf_active( + vnf_id, + constants.VNF_CIRROS_CREATE_TIMEOUT, + constants.ACTIVE_SLEEP_TIME) self.assertEqual(vnf_current_status, 'ACTIVE') self.validate_vnf_instance(vnfd_instance, vnf_instance) diff --git a/tacker/tests/functional/vnfm/test_vnf.py b/tacker/tests/functional/vnfm/test_vnf.py index 37941e0cd..5e292438d 100644 --- a/tacker/tests/functional/vnfm/test_vnf.py +++ b/tacker/tests/functional/vnfm/test_vnf.py @@ -43,9 +43,10 @@ class VnfTestCreate(base.BaseTackerTest): self.validate_vnf_instance(vnfd_instance, vnf_instance) vnf_id = vnf_instance['vnf']['id'] - vnf_current_status = self.wait_until_vnf_active(vnf_id, - constants.VNF_CIRROS_CREATE_TIMEOUT, - constants.ACTIVE_SLEEP_TIME) + vnf_current_status = self.wait_until_vnf_active( + vnf_id, + constants.VNF_CIRROS_CREATE_TIMEOUT, + constants.ACTIVE_SLEEP_TIME) self.assertEqual(vnf_current_status, 'ACTIVE') self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf']['mgmt_url']) diff --git a/tacker/tests/functional/vnfm/test_vnf_multiple_vdu.py b/tacker/tests/functional/vnfm/test_vnf_multiple_vdu.py index d8d084d86..95303896c 100644 --- a/tacker/tests/functional/vnfm/test_vnf_multiple_vdu.py +++ b/tacker/tests/functional/vnfm/test_vnf_multiple_vdu.py @@ -38,7 +38,7 @@ class VnfTestMultipleVDU(base.BaseTackerTest): # Create vnf with vnfd_id vnfd_id = vnfd_instance['vnfd']['id'] vnf_arg = {'vnf': {'vnfd_id': vnfd_id, 'name': - "test_vnf_with_multiple_vdus"}} + "test_vnf_with_multiple_vdus"}} vnf_instance = self.client.create_vnf(body=vnf_arg) vnf_id = vnf_instance['vnf']['id'] diff --git a/tacker/tests/functional/vnfm/test_vnfm_param.py b/tacker/tests/functional/vnfm/test_vnfm_param.py index 9069802d1..f8950f767 100644 --- a/tacker/tests/functional/vnfm/test_vnfm_param.py +++ b/tacker/tests/functional/vnfm/test_vnfm_param.py @@ -59,9 +59,10 @@ class VnfmTestParam(base.BaseTackerTest): self.validate_vnf_instance(vnfd_instance, vnf_instance) vnf_id = vnf_instance['vnf']['id'] - vnf_current_status = self.wait_until_vnf_active(vnf_id, - constants.VNF_CIRROS_CREATE_TIMEOUT, - constants.ACTIVE_SLEEP_TIME) + vnf_current_status = self.wait_until_vnf_active( + vnf_id, + constants.VNF_CIRROS_CREATE_TIMEOUT, + constants.ACTIVE_SLEEP_TIME) self.assertEqual('ACTIVE', vnf_current_status) self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf']['mgmt_url']) vnf_instance = self.client.show_vnf(vnf_id) @@ -93,7 +94,7 @@ class VnfmTestParam(base.BaseTackerTest): def test_vnf_param(self): vnfd_instance = self._test_vnfd_create('sample_cirros_vnf_param.yaml') vnf_instance = self._test_vnf_create(vnfd_instance, - 'test_vnf_with_parameters', - 'sample_cirros_vnf_values.yaml') + 'test_vnf_with_parameters', + 'sample_cirros_vnf_values.yaml') self._test_vnf_delete(vnf_instance) self._test_vnfd_delete(vnfd_instance) diff --git a/tacker/tests/unit/test_wsgi.py b/tacker/tests/unit/test_wsgi.py index d837ba5ca..75dbb79ea 100644 --- a/tacker/tests/unit/test_wsgi.py +++ b/tacker/tests/unit/test_wsgi.py @@ -340,7 +340,7 @@ class RequestDeserializerTest(testtools.TestCase): def test_deserialize(self): """Test RequestDeserializer.deserialize.""" with mock.patch.object( - self.deserializer, 'get_action_args') as mock_method: + self.deserializer, 'get_action_args') as mock_method: mock_method.return_value = {'action': 'create'} request = wsgi.Request.blank('/') request.headers['Accept'] = 'application/xml' diff --git a/tacker/tests/unit/vm/monitor_drivers/http_ping/test_http_ping.py b/tacker/tests/unit/vm/monitor_drivers/http_ping/test_http_ping.py index 28b369e55..400c8ca74 100644 --- a/tacker/tests/unit/vm/monitor_drivers/http_ping/test_http_ping.py +++ b/tacker/tests/unit/vm/monitor_drivers/http_ping/test_http_ping.py @@ -44,7 +44,7 @@ class TestVNFMonitorHTTPPing(testtools.TestCase): 'mgmt_ip': 'a.b.c.d' } monitor_return = self.monitor_http_ping.monitor_call(test_device, - test_kwargs) + test_kwargs) self.assertEqual(monitor_return, 'failure') def test_monitor_url(self): diff --git a/tacker/tests/unit/vm/monitor_drivers/ping/test_ping.py b/tacker/tests/unit/vm/monitor_drivers/ping/test_ping.py index f46da8a1c..cadfad0b9 100644 --- a/tacker/tests/unit/vm/monitor_drivers/ping/test_ping.py +++ b/tacker/tests/unit/vm/monitor_drivers/ping/test_ping.py @@ -31,10 +31,10 @@ class TestVNFMonitorPing(testtools.TestCase): 'mgmt_ip': 'a.b.c.d' } mock_ping_cmd = ['ping', - '-c', 5, - '-W', 1, - '-i', '0.2', - 'a.b.c.d'] + '-c', 5, + '-W', 1, + '-i', '0.2', + 'a.b.c.d'] self.monitor_ping.monitor_call(test_device, test_kwargs) mock_utils_execute.assert_called_once_with(mock_ping_cmd, @@ -48,7 +48,7 @@ class TestVNFMonitorPing(testtools.TestCase): 'mgmt_ip': 'a.b.c.d' } monitor_return = self.monitor_ping.monitor_call(test_device, - test_kwargs) + test_kwargs) self.assertEqual(monitor_return, 'failure') def test_monitor_url(self): diff --git a/tacker/tests/unit/vm/test_monitor.py b/tacker/tests/unit/vm/test_monitor.py index 6c5dade7b..ffe66cd82 100644 --- a/tacker/tests/unit/vm/test_monitor.py +++ b/tacker/tests/unit/vm/test_monitor.py @@ -62,7 +62,7 @@ class TestVNFMonitor(testtools.TestCase): 'mgmt_url': '{"vdu1": "a.b.c.d"}', 'attributes': { 'monitoring_policy': json.dumps( - MOCK_VNF_DEVICE['monitoring_policy']) + MOCK_VNF_DEVICE['monitoring_policy']) } } action_cb = mock.MagicMock() diff --git a/tacker/vm/drivers/heat/heat.py b/tacker/vm/drivers/heat/heat.py index 0af6fa725..a560f85a1 100644 --- a/tacker/vm/drivers/heat/heat.py +++ b/tacker/vm/drivers/heat/heat.py @@ -259,7 +259,7 @@ class DeviceHeat(abstract_driver.DeviceAbstractDriver): elif 'user_data' in vdu_dict or 'user_data_format' in vdu_dict: raise vnfm.UserDataFormatNotFound() if ('placement_policy' in vdu_dict and - 'availability_zone' in vdu_dict['placement_policy']): + 'availability_zone' in vdu_dict['placement_policy']): properties['availability_zone'] = vdu_dict[ 'placement_policy']['availability_zone'] if 'config' in vdu_dict: @@ -276,9 +276,10 @@ class DeviceHeat(abstract_driver.DeviceAbstractDriver): # This should be removed after Mitaka if monitoring_policy == 'ping' and failure_policy == 'respawn': vdu_dict['monitoring_policy'] = {'ping': { - 'actions': { - 'failure': 'respawn' - }}} + 'actions': + { + 'failure': 'respawn' + }}} vdu_dict.pop('failure_policy') if monitoring_policy != 'noop': @@ -294,7 +295,7 @@ class DeviceHeat(abstract_driver.DeviceAbstractDriver): if monitoring_dict.keys(): device['attributes']['monitoring_policy'] = jsonutils.dumps( - monitoring_dict) + monitoring_dict) heat_template_yaml = yaml.dump(template_dict) fields['template'] = heat_template_yaml diff --git a/tacker/vm/drivers/nova/nova.py b/tacker/vm/drivers/nova/nova.py index 70bf4ac00..cf0b3c1a3 100644 --- a/tacker/vm/drivers/nova/nova.py +++ b/tacker/vm/drivers/nova/nova.py @@ -254,7 +254,7 @@ class DeviceNova(abstract_driver.DeviceAbstractDriver): instance = nova.servers.get(device_id) except self._novaclient.exceptions.NotFound: LOG.error(_LE("server %s is not found") % - device_id) + device_id) return instance.delete() @@ -280,7 +280,7 @@ class DeviceNova(abstract_driver.DeviceAbstractDriver): instance = nova.servers.get(device_id) except self._novaclient.exceptions.NotFound: LOG.error(_LE("server %s is not found") % - device_id) + device_id) return instance.interface_attach(port_id, None, None) @@ -292,6 +292,6 @@ class DeviceNova(abstract_driver.DeviceAbstractDriver): instance = nova.servers.get(device_id) except self._novaclient.exceptions.NotFound: LOG.error(_LE("server %s is not found") % - device_id) + device_id) return instance.interface_detach(port_id) diff --git a/tacker/vm/mgmt_drivers/openwrt/openwrt.py b/tacker/vm/mgmt_drivers/openwrt/openwrt.py index 2d07c3577..b6b81bfe9 100644 --- a/tacker/vm/mgmt_drivers/openwrt/openwrt.py +++ b/tacker/vm/mgmt_drivers/openwrt/openwrt.py @@ -62,7 +62,7 @@ class DeviceMgmtOpenWRT(abstract_driver.DeviceMGMTAbstractDriver): @log.log def mgmt_call(self, plugin, context, device, kwargs): if (kwargs[mgmt_constants.KEY_ACTION] != - mgmt_constants.ACTION_UPDATE_DEVICE): + mgmt_constants.ACTION_UPDATE_DEVICE): return dev_attrs = device.get('attributes', {}) diff --git a/tacker/vm/monitor.py b/tacker/vm/monitor.py index 780c91133..9edd916ce 100644 --- a/tacker/vm/monitor.py +++ b/tacker/vm/monitor.py @@ -114,15 +114,15 @@ class VNFMonitor(object): hosting_vnf = self._hosting_vnfs.pop(device_id, None) if hosting_vnf: LOG.debug('deleting device_id %(device_id)s, Mgmt IP %(ips)s', - {'device_id': device_id, - 'ips': hosting_vnf['management_ip_addresses']}) + {'device_id': device_id, + 'ips': hosting_vnf['management_ip_addresses']}) def run_monitor(self, hosting_vnf): mgmt_ips = hosting_vnf['management_ip_addresses'] vdupolicies = hosting_vnf['monitoring_policy']['vdus'] vnf_delay = hosting_vnf['monitoring_policy'].get( - 'monitoring_delay', self.boot_wait) + 'monitoring_delay', self.boot_wait) for vdu in vdupolicies.keys(): if hosting_vnf.get('dead'): @@ -135,8 +135,8 @@ class VNFMonitor(object): vdu_delay = params.get('monitoring_delay', vnf_delay) if not timeutils.is_older_than( - hosting_vnf['boot_at'], - vdu_delay): + hosting_vnf['boot_at'], + vdu_delay): continue actions = policy[driver].get('actions', {}) @@ -171,7 +171,7 @@ class VNFMonitor(object): def monitor_call(self, driver, device_dict, kwargs): return self._invoke(driver, - device=device_dict, kwargs=kwargs) + device=device_dict, kwargs=kwargs) @six.add_metaclass(abc.ABCMeta) @@ -293,9 +293,9 @@ class ActionRespawnHeat(ActionPolicy): # ungly hack to keep id unchanged dead_device_id = device_id + '-DEAD-' + failure_count_str LOG.debug(_('%(dead)s %(new)s %(cur)s'), - {'dead': dead_device_id, - 'new': new_device_id, - 'cur': device_id}) + {'dead': dead_device_id, + 'new': new_device_id, + 'cur': device_id}) plugin.rename_device_id(context, device_id, dead_device_id) plugin.rename_device_id(context, new_device_id, device_id) LOG.debug('Delete dead device') diff --git a/tacker/vm/monitor_drivers/ping/ping.py b/tacker/vm/monitor_drivers/ping/ping.py index f87479b61..0290f6554 100644 --- a/tacker/vm/monitor_drivers/ping/ping.py +++ b/tacker/vm/monitor_drivers/ping/ping.py @@ -58,10 +58,10 @@ class VNFMonitorPing(abstract_driver.VNFMonitorAbstractDriver): :return: bool - True or string 'failure' depending on pingability. """ ping_cmd = ['ping', - '-c', count, - '-W', timeout, - '-i', interval, - mgmt_ip] + '-c', count, + '-W', timeout, + '-i', interval, + mgmt_ip] try: linux_utils.execute(ping_cmd, check_exit_code=True) diff --git a/tacker/vm/plugin.py b/tacker/vm/plugin.py index d02ac087d..3b99c8968 100644 --- a/tacker/vm/plugin.py +++ b/tacker/vm/plugin.py @@ -47,7 +47,7 @@ class VNFMMgmtMixin(object): 'Hosting Device/logical service ' 'instance tacker plugin will use')), cfg.IntOpt('boot_wait', default=30, - help=_('Time interval to wait for VM to boot')), + help=_('Time interval to wait for VM to boot')), ] cfg.CONF.register_opts(OPTS, 'tacker') @@ -167,7 +167,7 @@ class VNFMPlugin(vm_db.VNFMPluginDb, VNFMMgmtMixin): if 'monitoring_policy' in dev_attrs and mgmt_url: def action_cb(hosting_vnf_, action): action_cls = monitor.ActionPolicy.get_policy(action, - device_dict) + device_dict) if action_cls: action_cls.execute_action(self, hosting_vnf['device']) @@ -250,7 +250,7 @@ class VNFMPlugin(vm_db.VNFMPluginDb, VNFMMgmtMixin): if instance_id is None: self._create_device_post(context, device_id, None, None, - device_dict) + device_dict) return device_dict['instance_id'] = instance_id diff --git a/tacker/wsgi.py b/tacker/wsgi.py index 25af615f2..95dc9eff1 100644 --- a/tacker/wsgi.py +++ b/tacker/wsgi.py @@ -705,7 +705,7 @@ class XMLDeserializer(TextDeserializer): parseError = False # Python2.7 if (hasattr(etree, 'ParseError') and - isinstance(e, getattr(etree, 'ParseError'))): + isinstance(e, getattr(etree, 'ParseError'))): parseError = True # Python2.6 elif isinstance(e, expat.ExpatError): @@ -752,9 +752,9 @@ class XMLDeserializer(TextDeserializer): result = dict() for attr in node.keys(): if (attr == 'xmlns' or - attr.startswith('xmlns:') or - attr == constants.XSI_ATTR or - attr == constants.TYPE_ATTR): + attr.startswith('xmlns:') or + attr == constants.XSI_ATTR or + attr == constants.TYPE_ATTR): continue result[self._get_key(attr)] = node.get(attr) children = list(node) diff --git a/tox.ini b/tox.ini index 1641ec244..a0f841867 100644 --- a/tox.ini +++ b/tox.ini @@ -55,13 +55,8 @@ commands = commands = {posargs} [flake8] -# E125 continuation line does not distinguish itself from next logical line -# 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 -# H302 import only modules -# H904 Wrap long lines in parentheses instead of a backslash -ignore = E125,E126,E128,E129,H302,H904 +ignore = E128 show-source = true builtins = _ exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools,.ropeproject