1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

SONAR: addons: bond: Merge if statements with the enclosing ones

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
This commit is contained in:
Julien Fortin
2022-05-30 22:47:58 +02:00
parent 81348c3266
commit 530e3a0b79

View File

@ -688,9 +688,8 @@ class bond(Addon, moduleBase):
'probably not supported on this system'
% (ifname, attr_name, user_config))
continue
elif link_exists:
elif link_exists and cached_value == nl_value:
# there should be a cached value if the link already exists
if cached_value == nl_value:
# if the user value is already cached: continue
continue
@ -836,8 +835,7 @@ class bond(Addon, moduleBase):
)
# if specific attributes need to be set we need to down the bond first
if ifla_info_data and is_link_up:
if self._should_down_bond(ifla_info_data):
if ifla_info_data and is_link_up and self._should_down_bond(ifla_info_data):
self.netlink.link_down_force(ifname)
is_link_up = False
else:
@ -938,8 +936,7 @@ class bond(Addon, moduleBase):
def _query_check_bond_slaves(self, ifaceobjcurr, attr, user_bond_slaves, running_bond_slaves):
query = 1
if user_bond_slaves and running_bond_slaves:
if not set(user_bond_slaves).symmetric_difference(running_bond_slaves):
if user_bond_slaves and running_bond_slaves and not set(user_bond_slaves).symmetric_difference(running_bond_slaves):
query = 0
# we want to display the same bond-slaves list as provided