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

Fix the return value for auto interface checks

Ticket: CM-7851
Reviewed By: CCR-3639
Testing Done: Tested a combination of auto and non-auto interfaces.

This fixes a regression introduced in 2.5.4 where ifreload was
picking up non-auto interfaces

This also fixes a minor issue with blacklisting interfaces introduced by
("450c679249b546dbc2cd97d81b49e011fec948bd remove blacklisted interfaces
only if they are upperifaces (ie root of the tree") when an interface
has multiple auto and non-auto stanzas (A rare case, but it was an easy
fix and around the same area).

example, the fix will now blacklist an interface only if all of its stanzas are
blacklisted. In the below example, swp4 is not blacklisted if user
specified auto because one of the iface stanzas is auto.

auto swp4
iface swp4

iface swp4
        address 10.0.14.2/24

(cherry picked from commit ad6d4567fdf9413c804a348c1712d8706934264a)
This commit is contained in:
Roopa Prabhu
2015-10-09 15:14:56 -07:00
parent c28fc55eb9
commit 19e2bf8c08

View File

@@ -814,7 +814,7 @@ class ifupdownMain(ifupdownBase):
"""
ret = True
# Check if interface matches the exclude patter
# Check if interface matches the exclude patter
if excludepats:
for e in excludepats:
if re.search(e, ifacename):
@@ -833,26 +833,33 @@ class ifupdownMain(ifupdownBase):
# Check if interface belongs to the class
# the user is interested in, if not return false
if allow_classes:
ret = False
for i in ifaceobjs:
if i.classes:
common = Set([allow_classes]).intersection(
Set(i.classes))
if common:
ret = True
else:
i.blacklisted = True
self.blacklisted_ifaces_present = True
if not ret:
return ret
# If a class was requested and interface does not belong
# to the class, only then mark the ifaceobjs as blacklisted
self.blacklisted_ifaces_present = True
for i in ifaceobjs:
i.blacklisted = True
return ret
# If the user has requested auto class, check if the interface
# is marked auto
if auto:
ret = False
for i in ifaceobjs:
if i.auto:
ret = True
else:
if not ret:
# If auto was requested and interface was not marked auto,
# only then mark all of them as blacklisted
self.blacklisted_ifaces_present = True
for i in ifaceobjs:
i.blacklisted = True
self.blacklisted_ifaces_present = True
return ret
def _compat_conv_op_to_mode(self, op):