From f944abda20c2f5035cd5e3191e0aca61faf6274a Mon Sep 17 00:00:00 2001 From: Julien Fortin Date: Mon, 20 Aug 2018 09:15:32 +0200 Subject: [PATCH] addons: vrf: fix link-down yes on vrf throws an exception 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 --- ifupdown2/addons/vrf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ifupdown2/addons/vrf.py b/ifupdown2/addons/vrf.py index 7cba995..509b52d 100644 --- a/ifupdown2/addons/vrf.py +++ b/ifupdown2/addons/vrf.py @@ -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) -- 2.39.2