Fix some pylint indentation warnings

Running with a stricter .pylintrc generates a lot of
C0330 warnings (hanging/continued indentation). Fix
some of them, about 10%.

Feel free to reject if we think it will cause too much
trouble with cherry-picks, else I'll slowly work my way
through the rest of the tree.

Trivialfix

Change-Id: I3d484d11e273cb8ee617f9445a069887e7b2b89f
This commit is contained in:
Brian Haley 2022-07-01 17:41:59 -04:00
parent ae87995a08
commit 58b1df699d
25 changed files with 71 additions and 71 deletions

View File

@ -18,7 +18,7 @@ from neutron_lib import constants
def main(): def main():
proctitle = "%s (%s)" % ( proctitle = "%s (%s)" % (
constants.AGENT_PROCESS_DHCP, setproctitle.getproctitle()) constants.AGENT_PROCESS_DHCP, setproctitle.getproctitle())
setproctitle.setproctitle(proctitle) setproctitle.setproctitle(proctitle)
dhcp_agent.main() dhcp_agent.main()

View File

@ -18,7 +18,7 @@ from neutron_lib import constants
def main(): def main():
proctitle = "%s (%s)" % ( proctitle = "%s (%s)" % (
constants.AGENT_PROCESS_L3, setproctitle.getproctitle()) constants.AGENT_PROCESS_L3, setproctitle.getproctitle())
setproctitle.setproctitle(proctitle) setproctitle.setproctitle(proctitle)
l3_agent.main() l3_agent.main()

View File

@ -18,7 +18,7 @@ from neutron_lib import constants
def main(): def main():
proctitle = "%s (%s)" % ( proctitle = "%s (%s)" % (
constants.AGENT_PROCESS_METADATA, setproctitle.getproctitle()) constants.AGENT_PROCESS_METADATA, setproctitle.getproctitle())
setproctitle.setproctitle(proctitle) setproctitle.setproctitle(proctitle)
metadata_agent.main() metadata_agent.main()

View File

@ -18,7 +18,7 @@ from neutron_lib import constants
def main(): def main():
proctitle = "%s (%s)" % ( proctitle = "%s (%s)" % (
constants.AGENT_PROCESS_OVN_METADATA, setproctitle.getproctitle()) constants.AGENT_PROCESS_OVN_METADATA, setproctitle.getproctitle())
setproctitle.setproctitle(proctitle) setproctitle.setproctitle(proctitle)
metadata_agent.main() metadata_agent.main()

View File

@ -22,7 +22,7 @@ from neutron_lib import constants
def main(): def main():
proctitle = "%s (%s)" % ( proctitle = "%s (%s)" % (
constants.AGENT_PROCESS_LINUXBRIDGE, setproctitle.getproctitle()) constants.AGENT_PROCESS_LINUXBRIDGE, setproctitle.getproctitle())
setproctitle.setproctitle(proctitle) setproctitle.setproctitle(proctitle)
agent_main.main() agent_main.main()

View File

@ -21,7 +21,7 @@ from neutron_lib import constants
def main(): def main():
proctitle = "%s (%s)" % ( proctitle = "%s (%s)" % (
constants.AGENT_PROCESS_MACVTAP, setproctitle.getproctitle()) constants.AGENT_PROCESS_MACVTAP, setproctitle.getproctitle())
setproctitle.setproctitle(proctitle) setproctitle.setproctitle(proctitle)
agent_main.main() agent_main.main()

View File

@ -21,7 +21,7 @@ from neutron_lib import constants
def main(): def main():
proctitle = "%s (%s)" % ( proctitle = "%s (%s)" % (
constants.AGENT_PROCESS_OVS, setproctitle.getproctitle()) constants.AGENT_PROCESS_OVS, setproctitle.getproctitle())
setproctitle.setproctitle(proctitle) setproctitle.setproctitle(proctitle)
agent_main.main() agent_main.main()

View File

@ -21,7 +21,7 @@ from neutron_lib import constants
def main(): def main():
proctitle = "%s (%s)" % ( proctitle = "%s (%s)" % (
constants.AGENT_PROCESS_NIC_SWITCH, setproctitle.getproctitle()) constants.AGENT_PROCESS_NIC_SWITCH, setproctitle.getproctitle())
setproctitle.setproctitle(proctitle) setproctitle.setproctitle(proctitle)
agent_main.main() agent_main.main()

View File

@ -18,7 +18,7 @@ from neutron_lib import constants
def main(): def main():
proctitle = "%s (%s)" % ( proctitle = "%s (%s)" % (
constants.AGENT_PROCESS_METERING, setproctitle.getproctitle()) constants.AGENT_PROCESS_METERING, setproctitle.getproctitle())
setproctitle.setproctitle(proctitle) setproctitle.setproctitle(proctitle)
metering_agent.main() metering_agent.main()

View File

@ -274,7 +274,7 @@ def ovs_qos_direct_port_supported():
ver = versionutils.convert_version_to_tuple(matched_version.group(1) if ver = versionutils.convert_version_to_tuple(matched_version.group(1) if
matched_version else '0.0') matched_version else '0.0')
minver = versionutils.convert_version_to_tuple( minver = versionutils.convert_version_to_tuple(
DIRECT_PORT_QOS_MIN_OVS_VERSION) DIRECT_PORT_QOS_MIN_OVS_VERSION)
if ver < minver: if ver < minver:
return False return False
except (OSError, RuntimeError, ValueError) as e: except (OSError, RuntimeError, ValueError) as e:
@ -590,7 +590,7 @@ def ovn_nb_db_schema_port_group_supported():
try: try:
ver = _get_ovn_version(OVNCheckType.nb_db_schema) ver = _get_ovn_version(OVNCheckType.nb_db_schema)
minver = versionutils.convert_version_to_tuple( minver = versionutils.convert_version_to_tuple(
OVN_NB_DB_SCHEMA_PORT_GROUP) OVN_NB_DB_SCHEMA_PORT_GROUP)
if ver < minver: if ver < minver:
return False return False
except (OSError, RuntimeError, ValueError) as e: except (OSError, RuntimeError, ValueError) as e:
@ -604,7 +604,7 @@ def ovn_nb_db_schema_stateless_nat_supported():
try: try:
ver = _get_ovn_version(OVNCheckType.nb_db_schema) ver = _get_ovn_version(OVNCheckType.nb_db_schema)
minver = versionutils.convert_version_to_tuple( minver = versionutils.convert_version_to_tuple(
OVN_NB_DB_SCHEMA_STATELESS_NAT) OVN_NB_DB_SCHEMA_STATELESS_NAT)
if ver < minver: if ver < minver:
return False return False
except (OSError, RuntimeError, ValueError) as e: except (OSError, RuntimeError, ValueError) as e:
@ -618,7 +618,7 @@ def ovn_sb_db_schema_virtual_port_supported():
try: try:
ver = _get_ovn_version(OVNCheckType.sb_db_schema) ver = _get_ovn_version(OVNCheckType.sb_db_schema)
minver = versionutils.convert_version_to_tuple( minver = versionutils.convert_version_to_tuple(
OVN_SB_DB_SCHEMA_VIRTUAL_PORT) OVN_SB_DB_SCHEMA_VIRTUAL_PORT)
if ver < minver: if ver < minver:
return False return False
except (OSError, RuntimeError, ValueError) as e: except (OSError, RuntimeError, ValueError) as e:

View File

@ -440,12 +440,12 @@ def enable_tests_from_config():
if cfg.CONF.SECURITYGROUP.enable_security_group: if cfg.CONF.SECURITYGROUP.enable_security_group:
cfg.CONF.set_default('ip6tables_installed', True) cfg.CONF.set_default('ip6tables_installed', True)
if cfg.CONF.SECURITYGROUP.firewall_driver in ( if cfg.CONF.SECURITYGROUP.firewall_driver in (
'iptables', 'iptables',
'iptables_hybrid', 'iptables_hybrid',
('neutron.agent.linux.iptables_firewall.' ('neutron.agent.linux.iptables_firewall.'
'IptablesFirewallDriver'), 'IptablesFirewallDriver'),
('neutron.agent.linux.iptables_firewall.' ('neutron.agent.linux.iptables_firewall.'
'OVSHybridIptablesFirewallDriver'), 'OVSHybridIptablesFirewallDriver'),
): ):
cfg.CONF.set_default('bridge_firewalling', True) cfg.CONF.set_default('bridge_firewalling', True)
if cfg.CONF.SRIOV_NIC.physical_device_mappings: if cfg.CONF.SRIOV_NIC.physical_device_mappings:

View File

@ -145,8 +145,7 @@ def get_fip_per_network_without_qos_policies(network_id):
query = query.filter(and_( query = query.filter(and_(
~exists().where(qos_models.QosFIPPolicyBinding.fip_id == ~exists().where(qos_models.QosFIPPolicyBinding.fip_id ==
l3_models.FloatingIP.id), l3_models.FloatingIP.id),
l3_models.FloatingIP.floating_network_id == network_id) l3_models.FloatingIP.floating_network_id == network_id))
)
return query.count() return query.count()

View File

@ -46,11 +46,11 @@ class Floating_ip_port_forwarding(api_extensions.APIExtensionDescriptor):
apidef.SUB_RESOURCE_ATTRIBUTE_MAP)) apidef.SUB_RESOURCE_ATTRIBUTE_MAP))
resources = resource_helper.build_resource_info( resources = resource_helper.build_resource_info(
plural_mappings, plural_mappings,
apidef.RESOURCE_ATTRIBUTE_MAP, apidef.RESOURCE_ATTRIBUTE_MAP,
plugin_consts.PORTFORWARDING, plugin_consts.PORTFORWARDING,
translate_name=True, translate_name=True,
allow_bulk=True) allow_bulk=True)
plugin = directory.get_plugin(plugin_consts.PORTFORWARDING) plugin = directory.get_plugin(plugin_consts.PORTFORWARDING)

View File

@ -32,11 +32,11 @@ class Floatingip_pools(api_extensions.APIExtensionDescriptor):
{}, itertools.chain(apidef.RESOURCE_ATTRIBUTE_MAP)) {}, itertools.chain(apidef.RESOURCE_ATTRIBUTE_MAP))
resources = resource_helper.build_resource_info( resources = resource_helper.build_resource_info(
plural_mappings, plural_mappings,
apidef.RESOURCE_ATTRIBUTE_MAP, apidef.RESOURCE_ATTRIBUTE_MAP,
constants.L3, constants.L3,
translate_name=True, translate_name=True,
allow_bulk=True) allow_bulk=True)
return resources return resources

View File

@ -50,11 +50,11 @@ class L3_conntrack_helper(api_extensions.APIExtensionDescriptor):
apidef.SUB_RESOURCE_ATTRIBUTE_MAP)) apidef.SUB_RESOURCE_ATTRIBUTE_MAP))
resources = resource_helper.build_resource_info( resources = resource_helper.build_resource_info(
plural_mappings, plural_mappings,
apidef.RESOURCE_ATTRIBUTE_MAP, apidef.RESOURCE_ATTRIBUTE_MAP,
plugin_consts.CONNTRACKHELPER, plugin_consts.CONNTRACKHELPER,
translate_name=True, translate_name=True,
allow_bulk=True) allow_bulk=True)
plugin = directory.get_plugin(plugin_consts.CONNTRACKHELPER) plugin = directory.get_plugin(plugin_consts.CONNTRACKHELPER)

View File

@ -35,11 +35,11 @@ class L3_ndp_proxy(api_extensions.APIExtensionDescriptor):
plural_mappings = resource_helper.build_plural_mappings( plural_mappings = resource_helper.build_plural_mappings(
special_mappings, apidef.RESOURCE_ATTRIBUTE_MAP) special_mappings, apidef.RESOURCE_ATTRIBUTE_MAP)
return resource_helper.build_resource_info( return resource_helper.build_resource_info(
plural_mappings, plural_mappings,
apidef.RESOURCE_ATTRIBUTE_MAP, apidef.RESOURCE_ATTRIBUTE_MAP,
plugin_consts.NDPPROXY, plugin_consts.NDPPROXY,
translate_name=True, translate_name=True,
allow_bulk=True) allow_bulk=True)
class NDPProxyBase(service_base.ServicePluginBase): class NDPProxyBase(service_base.ServicePluginBase):

View File

@ -40,11 +40,11 @@ class Logging(api_extensions.APIExtensionDescriptor):
{}, itertools.chain(apidef.RESOURCE_ATTRIBUTE_MAP)) {}, itertools.chain(apidef.RESOURCE_ATTRIBUTE_MAP))
resources = resource_helper.build_resource_info( resources = resource_helper.build_resource_info(
plural_mappings, plural_mappings,
apidef.RESOURCE_ATTRIBUTE_MAP, apidef.RESOURCE_ATTRIBUTE_MAP,
plugin_const.LOG_API, plugin_const.LOG_API,
translate_name=True, translate_name=True,
allow_bulk=True) allow_bulk=True)
return resources return resources

View File

@ -48,11 +48,11 @@ class Qos(api_extensions.APIExtensionDescriptor):
apidef.SUB_RESOURCE_ATTRIBUTE_MAP)) apidef.SUB_RESOURCE_ATTRIBUTE_MAP))
resources = resource_helper.build_resource_info( resources = resource_helper.build_resource_info(
plural_mappings, plural_mappings,
apidef.RESOURCE_ATTRIBUTE_MAP, apidef.RESOURCE_ATTRIBUTE_MAP,
constants.QOS, constants.QOS,
translate_name=True, translate_name=True,
allow_bulk=True) allow_bulk=True)
plugin = directory.get_plugin(constants.QOS) plugin = directory.get_plugin(constants.QOS)
for collection_name in apidef.SUB_RESOURCE_ATTRIBUTE_MAP: for collection_name in apidef.SUB_RESOURCE_ATTRIBUTE_MAP:
@ -95,14 +95,14 @@ class QoSPluginBase(service_base.ServicePluginBase, metaclass=abc.ABCMeta):
# Patterns used to call method proxies for all policy-rule-specific # Patterns used to call method proxies for all policy-rule-specific
# method calls (see __getattr__ docstring, below). # method calls (see __getattr__ docstring, below).
qos_rule_method_patterns = [ qos_rule_method_patterns = [
re.compile( re.compile(
r"^((create|update|delete)_policy_(?P<rule_type>.*)_rule)$"), r"^((create|update|delete)_policy_(?P<rule_type>.*)_rule)$"),
re.compile( re.compile(
r"^(get_policy_(?P<rule_type>.*)_(rules|rule))$"), r"^(get_policy_(?P<rule_type>.*)_(rules|rule))$"),
# The following entry handles rule alias calls # The following entry handles rule alias calls
re.compile( re.compile(
r"^((update|delete|get)_alias_(?P<rule_type>.*)_rule)$"), r"^((update|delete|get)_alias_(?P<rule_type>.*)_rule)$"),
] ]
def __getattr__(self, attrib): def __getattr__(self, attrib):
"""Implement method proxies for all policy-rule-specific requests. For """Implement method proxies for all policy-rule-specific requests. For

View File

@ -25,7 +25,7 @@ class Qos_pps_minimum_rule(api_extensions.APIExtensionDescriptor):
@classmethod @classmethod
def get_resources(cls): def get_resources(cls):
plural_mappings = resource_helper.build_plural_mappings( plural_mappings = resource_helper.build_plural_mappings(
{}, apidef.SUB_RESOURCE_ATTRIBUTE_MAP) {}, apidef.SUB_RESOURCE_ATTRIBUTE_MAP)
return resource_helper.build_resource_info( return resource_helper.build_resource_info(
plural_mappings, plural_mappings,

View File

@ -25,7 +25,7 @@ class Qos_pps_minimum_rule_alias(api_extensions.APIExtensionDescriptor):
@classmethod @classmethod
def get_resources(cls): def get_resources(cls):
plural_mappings = resource_helper.build_plural_mappings( plural_mappings = resource_helper.build_plural_mappings(
{}, apidef.RESOURCE_ATTRIBUTE_MAP) {}, apidef.RESOURCE_ATTRIBUTE_MAP)
return resource_helper.build_resource_info( return resource_helper.build_resource_info(
plural_mappings, plural_mappings,

View File

@ -27,7 +27,7 @@ class Qos_rules_alias(api_extensions.APIExtensionDescriptor):
def get_resources(cls): def get_resources(cls):
"""Returns Ext Resources.""" """Returns Ext Resources."""
plural_mappings = resource_helper.build_plural_mappings( plural_mappings = resource_helper.build_plural_mappings(
{}, apidef.RESOURCE_ATTRIBUTE_MAP) {}, apidef.RESOURCE_ATTRIBUTE_MAP)
return resource_helper.build_resource_info( return resource_helper.build_resource_info(
plural_mappings, plural_mappings,

View File

@ -86,10 +86,11 @@ class QuotaSetsController(wsgi.Controller):
context = request.context context = request.context
if id != context.project_id: if id != context.project_id:
validate_policy(context, "get_quota") validate_policy(context, "get_quota")
return {self._resource_name: self._driver.get_default_quotas( return {self._resource_name:
context=context, self._driver.get_default_quotas(
resources=resource_registry.get_all_resources(), context=context,
project_id=id)} resources=resource_registry.get_all_resources(),
project_id=id)}
def create(self, request, body=None): def create(self, request, body=None):
msg = _('POST requests are not supported on this resource.') msg = _('POST requests are not supported on this resource.')

View File

@ -157,7 +157,7 @@ def list_db_opts():
neutron.conf.db.extraroute_db.EXTRA_ROUTE_OPTS, neutron.conf.db.extraroute_db.EXTRA_ROUTE_OPTS,
neutron.conf.db.l3_gwmode_db.L3GWMODE_OPTS, neutron.conf.db.l3_gwmode_db.L3GWMODE_OPTS,
neutron.conf.agent.database.agentschedulers_db neutron.conf.agent.database.agentschedulers_db
.AGENTS_SCHEDULER_OPTS, .AGENTS_SCHEDULER_OPTS,
neutron.conf.db.dvr_mac_db.DVR_MAC_ADDRESS_OPTS, neutron.conf.db.dvr_mac_db.DVR_MAC_ADDRESS_OPTS,
neutron.conf.db.l3_dvr_db.ROUTER_DISTRIBUTED_OPTS, neutron.conf.db.l3_dvr_db.ROUTER_DISTRIBUTED_OPTS,
neutron.conf.db.l3_agentschedulers_db.L3_AGENTS_SCHEDULER_OPTS, neutron.conf.db.l3_agentschedulers_db.L3_AGENTS_SCHEDULER_OPTS,
@ -180,7 +180,7 @@ def list_opts():
), ),
(neutron.conf.common.NOVA_CONF_SECTION, (neutron.conf.common.NOVA_CONF_SECTION,
itertools.chain( itertools.chain(
neutron.conf.common.nova_opts) neutron.conf.common.nova_opts)
), ),
(neutron.conf.common.IRONIC_CONF_SECTION, (neutron.conf.common.IRONIC_CONF_SECTION,
itertools.chain( itertools.chain(

View File

@ -264,7 +264,7 @@ class TrackedResource(BaseResource):
{'project_id': project_id, 'resource': self.name}) {'project_id': project_id, 'resource': self.name})
in_use = context.session.query( in_use = context.session.query(
self._model_class.project_id).filter_by( self._model_class.project_id).filter_by(
project_id=project_id).count() project_id=project_id).count()
# Update quota usage # Update quota usage
return self._resync(context, project_id, in_use) return self._resync(context, project_id, in_use)
@ -295,7 +295,7 @@ class TrackedResource(BaseResource):
'project_id': project_id}) 'project_id': project_id})
in_use = context.session.query( in_use = context.session.query(
self._model_class.project_id).filter_by( self._model_class.project_id).filter_by(
project_id=project_id).count() project_id=project_id).count()
# Update quota usage, if requested (by default do not do that, as # Update quota usage, if requested (by default do not do that, as
# typically one counts before adding a record, and that would mark # typically one counts before adding a record, and that would mark

View File

@ -148,7 +148,7 @@ class Server(object):
eventlet.sleep(0.1) eventlet.sleep(0.1)
if not sock: if not sock:
raise RuntimeError(_("Could not bind to %(host)s:%(port)s " raise RuntimeError(_("Could not bind to %(host)s:%(port)s "
"after trying for %(time)d seconds") % "after trying for %(time)d seconds") %
{'host': host, {'host': host,
'port': port, 'port': port,
'time': CONF.retry_until_window}) 'time': CONF.retry_until_window})