mirror of
https://opendev.org/openstack/neutron.git
synced 2026-01-16 23:11:58 +00:00
Update tox.ini for pep8
N530 was in both enable and ignore, removed from enable as it should be ignored. Fixed H701, H702 and H703 warnings and removed them from ignore list so they are enforced. TrivialFix Change-Id: I07792b6907f551f428d9c8d3986017a4e9d2441f Signed-off-by: Brian Haley <haleyb.dev@gmail.com>
This commit is contained in:
parent
a8e636cc58
commit
34ef8ca4aa
18 changed files with 72 additions and 60 deletions
|
|
@ -232,9 +232,10 @@ class MetadataPathAgentExtension(
|
|||
try:
|
||||
ns_dev.link.set_address(DEFAULT_META_GATEWAY_MAC)
|
||||
except RuntimeError as e:
|
||||
msg = _("Failed to set mac address "
|
||||
"for dev %s, error: %s") % (self.META_DEV_NAME, e)
|
||||
raise RuntimeError(msg)
|
||||
raise RuntimeError(
|
||||
_("Failed to set mac address "
|
||||
"for dev %(dev)s, error: %(error)s") %
|
||||
{'dev': self.META_DEV_NAME, 'error': e})
|
||||
|
||||
cidr = "{}/{}".format(
|
||||
self.provider_gateway_ip,
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ class ConntrackdManager:
|
|||
pid = utils.pgrep(cmd)
|
||||
|
||||
if not pid:
|
||||
raise RuntimeError(_('No process for "%s" found.' % cmd))
|
||||
raise RuntimeError(_('No process for "%s" found.') % cmd)
|
||||
|
||||
file_utils.replace_file(pid_file, pid)
|
||||
|
||||
|
|
|
|||
|
|
@ -341,9 +341,10 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
|
|||
current_mac = converters.convert_to_sanitized_mac_address(
|
||||
device.link.address)
|
||||
if current_mac != mac_address:
|
||||
msg = _("Failed to set mac address to: %s; "
|
||||
"Current mac: %s") % (mac_address, current_mac)
|
||||
raise RuntimeError(msg)
|
||||
raise RuntimeError(
|
||||
_("Failed to set mac address to: %(mac)s; "
|
||||
"Current mac: %(current_mac)s") %
|
||||
{'mac': mac_address, 'current_mac': current_mac})
|
||||
|
||||
def _ensure_device_address(self, device, mac_address):
|
||||
mac_address = converters.convert_to_sanitized_mac_address(mac_address)
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ class ServerInterface(Interface):
|
|||
if len(matching_vms) < 1:
|
||||
raise Exception(_('Server not found'))
|
||||
if len(matching_vms) > 1:
|
||||
raise Exception(_('Multiple VMs match %s' % self.query))
|
||||
raise Exception(_('Multiple VMs match %s') % self.query)
|
||||
return matching_vms[0]
|
||||
|
||||
@cached_property
|
||||
|
|
|
|||
|
|
@ -500,8 +500,8 @@ class CoreChecks(base.BaseChecks):
|
|||
upgradecheck.Code.WARNING,
|
||||
_('The following projects have duplicated HA networks: '
|
||||
'%(project_ids)s. This is the list of duplicated HA '
|
||||
'networks: %(network_ids)s' %
|
||||
{'project_ids': project_ids, 'network_ids': network_ids}))
|
||||
'networks: %(network_ids)s') %
|
||||
{'project_ids': project_ids, 'network_ids': network_ids})
|
||||
|
||||
return upgradecheck.Result(
|
||||
upgradecheck.Code.SUCCESS,
|
||||
|
|
@ -529,10 +529,9 @@ class CoreChecks(base.BaseChecks):
|
|||
upgradecheck.Code.WARNING,
|
||||
_("Invalid OVN connection parameters provided."))
|
||||
except Exception as err:
|
||||
err_msg = "Failed to connect to OVN. Error: %s" % err
|
||||
return upgradecheck.Result(
|
||||
upgradecheck.Code.WARNING,
|
||||
_(err_msg))
|
||||
_("Failed to connect to OVN. Error: %s") % err)
|
||||
|
||||
if ovn_client.is_ipxe_over_ipv6_supported:
|
||||
return upgradecheck.Result(
|
||||
|
|
@ -619,9 +618,9 @@ class CoreChecks(base.BaseChecks):
|
|||
'created. There is a limit of %(limit)d tags per '
|
||||
'resource and because of that limit creation of new '
|
||||
'tags for the resources that exceed the limit will '
|
||||
'not be possible until some of the tags are removed.' %
|
||||
{'limit': tagging.MAX_TAGS_COUNT}))
|
||||
'not be possible until some of the tags are removed.') %
|
||||
{'limit': tagging.MAX_TAGS_COUNT})
|
||||
return upgradecheck.Result(
|
||||
upgradecheck.Code.SUCCESS,
|
||||
_('Number of tags for each resource is below the limit of %d. ' %
|
||||
tagging.MAX_TAGS_COUNT))
|
||||
_('Number of tags for each resource is below the limit of %d. ') %
|
||||
tagging.MAX_TAGS_COUNT)
|
||||
|
|
|
|||
|
|
@ -266,8 +266,9 @@ class MetadataProxyHandlerBaseSocketServer(
|
|||
network_id, router_id = self._get_instance_id(req)
|
||||
if network_id and router_id:
|
||||
title = '400 Bad Request'
|
||||
msg = _('Both network %s and router %s '
|
||||
'defined.') % (network_id, router_id)
|
||||
msg = (_('Both network %(network)s and router %(router)s '
|
||||
'defined.') %
|
||||
{'network': network_id, 'router': router_id})
|
||||
LOG.warning(msg)
|
||||
elif network_id:
|
||||
title = '404 Not Found'
|
||||
|
|
|
|||
|
|
@ -127,13 +127,15 @@ class OvsdbClientCommand:
|
|||
db = command[0]
|
||||
except IndexError:
|
||||
raise KeyError(
|
||||
_("{} or {} schema must be specified in the command {}".format(
|
||||
cls.OVN_Northbound, cls.OVN_Southbound, command)))
|
||||
_("{} or {} schema must be specified in the "
|
||||
"command {}").format(
|
||||
cls.OVN_Northbound, cls.OVN_Southbound, command))
|
||||
|
||||
if db not in (cls.OVN_Northbound, cls.OVN_Southbound):
|
||||
raise KeyError(
|
||||
_("{} or {} schema must be specified in the command {}".format(
|
||||
cls.OVN_Northbound, cls.OVN_Southbound, command)))
|
||||
_("{} or {} schema must be specified in the "
|
||||
"command {}").format(
|
||||
cls.OVN_Northbound, cls.OVN_Southbound, command))
|
||||
|
||||
cmd = ['ovsdb-client',
|
||||
cls.COMMAND,
|
||||
|
|
@ -172,10 +174,10 @@ def ovn_context(txn_var_name='txn', idl_var_name='idl'):
|
|||
signature = inspect.signature(f)
|
||||
if (txn_var_name not in signature.parameters or
|
||||
idl_var_name not in signature.parameters):
|
||||
msg = (_('Could not find variables %s and %s in the method '
|
||||
'signature') %
|
||||
(txn_var_name, idl_var_name))
|
||||
raise RuntimeError(msg)
|
||||
raise RuntimeError(
|
||||
_('Could not find variables %(txn)s and %(idl)s in the method '
|
||||
'signature') %
|
||||
{'txn': txn_var_name, 'idl': idl_var_name})
|
||||
|
||||
def retrieve_parameter(param_name, _args, _kwargs):
|
||||
# Position of the parameter "param_name" in the "args" tuple.
|
||||
|
|
|
|||
|
|
@ -568,7 +568,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
|
|||
if non_auto_ports.count():
|
||||
ports = [port.id for port in non_auto_ports.all()]
|
||||
reason = _("There are one or more ports still in use on the "
|
||||
"network, id for these ports is: %s" % ",".join(ports))
|
||||
"network, id for these ports is: %s") % ",".join(ports)
|
||||
raise exc.NetworkInUse(net_id=net_id, reason=reason)
|
||||
|
||||
@db_api.retry_if_session_inactive()
|
||||
|
|
|
|||
|
|
@ -315,9 +315,10 @@ class ExtraGatewaysDbOnlyMixin(l3_gwmode_db.L3_NAT_dbonly_mixin):
|
|||
raise mh_exc.UnableToMatchGateways(
|
||||
router_id=router_id,
|
||||
reason=_('could not match a gateway port attached to '
|
||||
'network %s based on the specified fixed IPs '
|
||||
'%s') % (net_id,
|
||||
gw_info['external_fixed_ips']))
|
||||
'network %(net_id)s based on the specified '
|
||||
'fixed IPs %(fips)s') %
|
||||
{'net_id': net_id,
|
||||
'fips': gw_info['external_fixed_ips']})
|
||||
nonexistent_port_info.append(gw_info)
|
||||
return matched_port_ids, part_matched_port_ids, nonexistent_port_info
|
||||
|
||||
|
|
|
|||
|
|
@ -134,10 +134,10 @@ def upgrade():
|
|||
if len(missed_tables) == len(tables_to_drop):
|
||||
raise Exception(_('The following tables have not been dropped '
|
||||
'from the Neutron database: %(missed_tables)s.\n'
|
||||
'List of errors: %(errors)s' %
|
||||
'List of errors: %(errors)s') %
|
||||
{'missed_tables': ', '.join(missed_tables),
|
||||
'errors': '\n'.join(errors)}
|
||||
))
|
||||
)
|
||||
|
||||
tables_to_drop = missed_tables
|
||||
|
||||
|
|
|
|||
|
|
@ -139,8 +139,8 @@ class SubnetRequest(metaclass=abc.ABCMeta):
|
|||
if ipam_utils.check_gateway_invalid_in_subnet(subnet_cidr, gateway_ip):
|
||||
raise ipam_exc.IpamValueInvalid(_(
|
||||
'Gateway IP %(gateway_ip)s cannot be the network or broadcast '
|
||||
'IP address %(subnet_cidr)s' % {'gateway_ip': gateway_ip,
|
||||
'subnet_cidr': subnet_cidr}))
|
||||
'IP address %(subnet_cidr)s') % {'gateway_ip': gateway_ip,
|
||||
'subnet_cidr': subnet_cidr})
|
||||
|
||||
|
||||
class AnySubnetRequest(SubnetRequest):
|
||||
|
|
|
|||
|
|
@ -3013,9 +3013,10 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
|
|||
def _validate_rp_pkt_processing_cfg(self):
|
||||
if self.rp_pp_with_direction and self.rp_pp_without_direction:
|
||||
raise ValueError(_(
|
||||
'%s and %s configuration options are mutually exclusive.') %
|
||||
(n_const.RP_PP_WITHOUT_DIRECTION,
|
||||
n_const.RP_PP_WITH_DIRECTION))
|
||||
'%(without)s and %(with)s configuration options are '
|
||||
'mutually exclusive.') %
|
||||
{'without': n_const.RP_PP_WITHOUT_DIRECTION,
|
||||
'with': n_const.RP_PP_WITH_DIRECTION})
|
||||
|
||||
|
||||
def validate_local_ip(local_ip):
|
||||
|
|
|
|||
|
|
@ -667,9 +667,10 @@ class OVNMechanismDriver(api.MechanismDriver):
|
|||
|
||||
if common_ips:
|
||||
err_msg = (
|
||||
_("IP addresses '%s' already used by the '%s' port(s) in "
|
||||
"the same network" % (";".join(common_ips),
|
||||
const.DEVICE_OWNER_DISTRIBUTED))
|
||||
_("IP addresses '%(ips)s' already used by the '%(dist)s' "
|
||||
"port(s) in the same network") %
|
||||
{'ips': ";".join(common_ips),
|
||||
'dist': const.DEVICE_OWNER_DISTRIBUTED}
|
||||
)
|
||||
raise n_exc.InvalidInput(error_message=err_msg)
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ def _sync_ha_chassis_group(txn, nb_api, name, chassis_priority,
|
|||
hcg = nb_api.lookup(table_name, name, default=None)
|
||||
if hcg:
|
||||
if not may_exist:
|
||||
raise RuntimeError(_('HA_Chassis_Group %s exists' % name))
|
||||
raise RuntimeError(_('HA_Chassis_Group %s exists') % name)
|
||||
else:
|
||||
hcg = txn.insert(nb_api._tables[table_name])
|
||||
hcg.name = name
|
||||
|
|
@ -868,9 +868,10 @@ class UpdateObjectExtIdsCommand(command.BaseCommand, metaclass=abc.ABCMeta):
|
|||
except idlutils.RowNotFound:
|
||||
if self.if_exists:
|
||||
return
|
||||
msg = _("%s %s does not exist. "
|
||||
"Can't update external IDs") % (self.table, self.record)
|
||||
raise RuntimeError(msg)
|
||||
raise RuntimeError(
|
||||
_("%(table)s %(record)s does not exist. "
|
||||
"Cannot update external IDs") %
|
||||
{'table': self.table, 'record': self.record})
|
||||
|
||||
for ext_id_key, ext_id_value in self.external_ids.items():
|
||||
obj.setkey('external_ids', ext_id_key, ext_id_value)
|
||||
|
|
|
|||
|
|
@ -1019,11 +1019,11 @@ class OvsdbSbOvnIdl(sb_impl_idl.OvnSbApiIdlImpl, Backend):
|
|||
in utils.get_ovn_chassis_other_config(ch).get(
|
||||
ovn_const.OVN_CMS_OPTIONS, '').split(',')):
|
||||
return ch
|
||||
msg = _('Chassis with %s %s %s does not exist'
|
||||
) % (ovn_const.OVN_CMS_OPTIONS,
|
||||
ovn_const.CMS_OPT_CARD_SERIAL_NUMBER,
|
||||
card_serial_number)
|
||||
raise RuntimeError(msg)
|
||||
raise RuntimeError(
|
||||
_('Chassis with %(options)s %(serial)s %(num)s does not exist') %
|
||||
{'options': ovn_const.OVN_CMS_OPTIONS,
|
||||
'serial': ovn_const.CMS_OPT_CARD_SERIAL_NUMBER,
|
||||
'num': card_serial_number})
|
||||
|
||||
def get_metadata_port(self, datapath_uuid):
|
||||
# TODO(twilson) This function should really just take a Row/RowView
|
||||
|
|
|
|||
|
|
@ -586,7 +586,7 @@ def create_netns(name, **kwargs):
|
|||
os._exit(1)
|
||||
os._exit(0)
|
||||
if os.waitpid(pid, 0)[1]:
|
||||
raise RuntimeError(_('Error creating namespace %s' % name))
|
||||
raise RuntimeError(_('Error creating namespace %s') % name)
|
||||
|
||||
|
||||
@privileged.namespace_cmd.entrypoint
|
||||
|
|
|
|||
|
|
@ -478,15 +478,16 @@ class PortForwardingPlugin(fip_pf.PortForwardingPluginBase):
|
|||
continue
|
||||
|
||||
existing_port = port_forwarding_registry.get(port_key)
|
||||
err_msg = _("There is a port collision with the %s. The "
|
||||
"following ranges collides: %s and %s")
|
||||
|
||||
if self._range_collides(existing_port, port):
|
||||
raise lib_exc.BadRequest(resource=apidef.RESOURCE_NAME,
|
||||
msg=err_msg % (
|
||||
port_key,
|
||||
existing_port,
|
||||
port))
|
||||
raise lib_exc.BadRequest(
|
||||
resource=apidef.RESOURCE_NAME,
|
||||
msg=_("There is a port collision with the %(key)s. The "
|
||||
"following ranges collide: %(existing)s and "
|
||||
"%(port)s") %
|
||||
{'key': port_key,
|
||||
'existing': existing_port,
|
||||
'port': port})
|
||||
|
||||
def _check_port_collisions(self, context, floatingip_id, pf_dict,
|
||||
id=None, internal_port_id=None,
|
||||
|
|
|
|||
9
tox.ini
9
tox.ini
|
|
@ -235,11 +235,14 @@ select = H,N
|
|||
# N521: jsonutils must be used instead of json
|
||||
# N524: Use of contextlib.nested is deprecated
|
||||
# N529: Method's default argument shouldn't be mutable
|
||||
# N530: Direct neutron imports not allowed
|
||||
# N532: Validate that LOG.warning is used instead of LOG.warn
|
||||
# N534: Exception messages should be translated
|
||||
# N535: Usage of Python eventlet module not allowed
|
||||
# N536: Use assertIsNone
|
||||
enable-extensions = H106,H203,H204,H205,H904,N521,N524,N529,N530,N532,N534,N535,N536
|
||||
ignore = H405,H701,H702,H703,N530
|
||||
enable-extensions = H106,H203,H204,H205,H904,N521,N524,N529,N532,N534,N535,N536
|
||||
# H405: multi line docstring summary not separated with an empty line
|
||||
# N530: Direct neutron imports not allowed
|
||||
ignore = H405,N530
|
||||
show-source = true
|
||||
exclude = ./.*,build,dist,doc
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue