Fix some pylint indentation warnings

Running with a stricter .pylintrc generates a lot of
C0330 warnings (hanging/continued indentation). Fix
the ones in neutron/api.

Trivialfix

Change-Id: I1258b04f64a18036407e1d9de9ddca7472af0d11
This commit is contained in:
Brian Haley 2022-11-02 10:11:46 -04:00
parent ba795c6692
commit 291eabb0b6
5 changed files with 20 additions and 18 deletions

View File

@ -464,8 +464,8 @@ def convert_exception_to_http_exc(e, faults, language):
for c in converted_exceptions: for c in converted_exceptions:
c_body = jsonutils.loads(c.body) c_body = jsonutils.loads(c.body)
err = ('HTTP %s %s: %s' % ( err = ('HTTP %s %s: %s' % (
c.code, c_body['NeutronError']['type'], c.code, c_body['NeutronError']['type'],
c_body['NeutronError']['message'])) c_body['NeutronError']['message']))
inner_error_strings.append(err) inner_error_strings.append(err)
new_exception.msg = "\n".join(inner_error_strings) new_exception.msg = "\n".join(inner_error_strings)
return convert_exception_to_http_exc( return convert_exception_to_http_exc(

View File

@ -313,7 +313,7 @@ class DhcpRpcCallback(object):
old_port = plugin.get_port(context, port['id']) old_port = plugin.get_port(context, port['id'])
if (old_port['device_id'] != if (old_port['device_id'] !=
constants.DEVICE_ID_RESERVED_DHCP_PORT and constants.DEVICE_ID_RESERVED_DHCP_PORT and
old_port['device_id'] != old_port['device_id'] !=
utils.get_dhcp_agent_device_id(network_id, host)): utils.get_dhcp_agent_device_id(network_id, host)):
return return
if not self._is_dhcp_agent_hosting_network(plugin, context, host, if not self._is_dhcp_agent_hosting_network(plugin, context, host,

View File

@ -192,9 +192,9 @@ class L3RpcCallback(object):
portbindings.VIF_TYPE_BINDING_FAILED, portbindings.VIF_TYPE_BINDING_FAILED,
portbindings.VIF_TYPE_UNBOUND) portbindings.VIF_TYPE_UNBOUND)
if (port and host is not None and if (port and host is not None and
(port.get('device_owner') != (port.get('device_owner') !=
constants.DEVICE_OWNER_DVR_INTERFACE and constants.DEVICE_OWNER_DVR_INTERFACE and
port.get(portbindings.HOST_ID) != host or not_bound)): port.get(portbindings.HOST_ID) != host or not_bound)):
# Ports owned by non-HA routers are bound again if they're # Ports owned by non-HA routers are bound again if they're
# already bound but the router moved to another host. # already bound but the router moved to another host.
@ -335,10 +335,10 @@ class L3RpcCallback(object):
updated_subnets = [] updated_subnets = []
for subnet_id, prefix in subnets.items(): for subnet_id, prefix in subnets.items():
updated_subnets.append(self.plugin.update_subnet( updated_subnets.append(
context, self.plugin.update_subnet(context,
subnet_id, subnet_id,
{'subnet': {'cidr': prefix}})) {'subnet': {'cidr': prefix}}))
return updated_subnets return updated_subnets
@db_api.retry_db_errors @db_api.retry_db_errors

View File

@ -236,10 +236,11 @@ class ResourcesPushRpcApi(object):
resources_by_type = self._classify_resources_by_type(resource_list) resources_by_type = self._classify_resources_by_type(resource_list)
LOG.debug( LOG.debug(
"Pushing event %s for resources: %s", event_type, "Pushing event %s for resources: %s", event_type,
{t: ["ID=%s,revision_number=%s" % ( {t:
getattr(obj, 'id', None), ["ID=%s,revision_number=%s" % (
getattr(obj, 'revision_number', None)) getattr(obj, 'id', None),
for obj in resources_by_type[t]] getattr(obj, 'revision_number', None))
for obj in resources_by_type[t]]
for t in resources_by_type}) for t in resources_by_type})
for resource_type, type_resources in resources_by_type.items(): for resource_type, type_resources in resources_by_type.items():
self._push(context, resource_type, type_resources, event_type) self._push(context, resource_type, type_resources, event_type)

View File

@ -330,7 +330,7 @@ class Controller(object):
request.context, obj_list[0]) request.context, obj_list[0])
collection = {self._collection: collection = {self._collection:
[self._filter_attributes( [self._filter_attributes(
obj, fields_to_strip=fields_to_strip) obj, fields_to_strip=fields_to_strip)
for obj in obj_list]} for obj in obj_list]}
pagination_links = pagination_helper.get_links(obj_list) pagination_links = pagination_helper.get_links(obj_list)
if pagination_links: if pagination_links:
@ -550,9 +550,10 @@ class Controller(object):
# should be removed because of authZ policies # should be removed because of authZ policies
fields_to_strip = self._exclude_attributes_by_policy( fields_to_strip = self._exclude_attributes_by_policy(
request.context, objs[0]) request.context, objs[0])
return notify({self._collection: [self._filter_attributes( return notify({self._collection:
obj, fields_to_strip=fields_to_strip) [self._filter_attributes(
for obj in objs]}) obj, fields_to_strip=fields_to_strip)
for obj in objs]})
else: else:
if self._collection in body: if self._collection in body:
# Emulate atomic bulk behavior # Emulate atomic bulk behavior