]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
addons: vrf: fix link-down yes on vrf throws an exception
authorJulien Fortin <julien@cumulusnetworks.com>
Mon, 20 Aug 2018 07:15:32 +0000 (09:15 +0200)
committerJulien Fortin <julien@cumulusnetworks.com>
Thu, 13 Dec 2018 22:43:57 +0000 (14:43 -0800)
before the patch we can see that ifreload is displaying an error
with the example config

$ ifquery -a
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto swp1
iface swp1
      vrf blue
         link-down yes

auto blue
iface blue
      vrf-table auto

$ ifreload -a
error: eth0: vrf blue not around, skipping vrf config
$ echo $?
1
$

$ # applying patch
$ ifreload -a
$ echo $?
0

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
ifupdown2/addons/vrf.py

index 7cba995f311fe597ce7eae475c16726a185ad996..509b52d2f2eb0d0bff7f85f5898f8ac2ddebffb6 100644 (file)
@@ -495,8 +495,9 @@ class vrf(moduleBase):
                     master_exists = False
             else:
                 master_exists = False
-            if master_exists and not ifaceobj.link_privflags & ifaceLinkPrivFlags.KEEP_LINK_DOWN:
-                netlink.link_set_updown(ifacename, "up")
+            if master_exists:
+                if not ifaceobj.link_privflags & ifaceLinkPrivFlags.KEEP_LINK_DOWN:
+                    netlink.link_set_updown(ifacename, "up")
             else:
                 self.log_error('vrf %s not around, skipping vrf config'
                                %(vrfname), ifaceobj)