Fix pylint E1128 (assignment-from-no-return) in l3-agent
Changed migrate_centralized_floating_ip() to return a status in DvrLocalRouter class. Also changed the parent method in RouterInfo class to return FLOATINGIP_STATUS_NOCHANGE, which will cause the agent to not send an updated status for the floating IP. Also changed floating_ip_added_dist() to not use an intermediate variable and just return directly. Change-Id: I7dc4934308da95cf00a36b4ef1020aac7cef7d99 Closes-bug: #1816874
This commit is contained in:
parent
d6fba30781
commit
2ac0ee0b28
|
@ -53,7 +53,7 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
|
|||
ip_cidr = common_utils.ip_to_cidr(fip['floating_ip_address'])
|
||||
self.floating_ip_removed_dist(ip_cidr)
|
||||
# Now add the floating_ip to the current host
|
||||
self.floating_ip_added_dist(fip, ip_cidr)
|
||||
return self.floating_ip_added_dist(fip, ip_cidr)
|
||||
|
||||
def floating_forward_rules(self, fip):
|
||||
"""Override this function defined in router_info for dvr routers."""
|
||||
|
@ -108,10 +108,7 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
|
|||
def floating_ip_added_dist(self, fip, fip_cidr):
|
||||
"""Add floating IP to respective namespace based on agent mode."""
|
||||
if fip.get(lib_constants.DVR_SNAT_BOUND):
|
||||
# TODO(dougwig) - remove this disable when fixing bug #1816874
|
||||
# pylint: disable=assignment-from-no-return
|
||||
floating_ip_status = self.add_centralized_floatingip(fip, fip_cidr)
|
||||
return floating_ip_status
|
||||
return self.add_centralized_floatingip(fip, fip_cidr)
|
||||
if not self._check_if_floatingip_bound_to_host(fip):
|
||||
# TODO(Swami): Need to figure out what status
|
||||
# should be returned when the floating IP is
|
||||
|
|
|
@ -314,7 +314,10 @@ class RouterInfo(object):
|
|||
raise NotImplementedError()
|
||||
|
||||
def migrate_centralized_floating_ip(self, fip, interface_name, device):
|
||||
pass
|
||||
"""Implements centralized->distributed floating IP migration.
|
||||
Overridden in dvr_local_router.py
|
||||
"""
|
||||
return FLOATINGIP_STATUS_NOCHANGE
|
||||
|
||||
def gateway_redirect_cleanup(self, rtr_interface):
|
||||
pass
|
||||
|
@ -377,8 +380,6 @@ class RouterInfo(object):
|
|||
fip.get('host') == self.host):
|
||||
LOG.debug("Floating IP is migrating from centralized "
|
||||
"to distributed: %s", fip)
|
||||
# TODO(dougwig) - remove this disable when fixing bug #1816874
|
||||
# pylint: disable=assignment-from-no-return
|
||||
fip_statuses[fip['id']] = self.migrate_centralized_floating_ip(
|
||||
fip, interface_name, device)
|
||||
elif fip_statuses[fip['id']] == fip['status']:
|
||||
|
|
Loading…
Reference in New Issue