From 3d58f6afc1a529df86f2e55e88df0d827ce1b59d Mon Sep 17 00:00:00 2001 From: Roopa Prabhu Date: Mon, 29 Feb 2016 23:04:08 -0800 Subject: [PATCH] networkinterfaces: fix is_keyword to not match attribute names with keywords in them Ticket: CM-8729 Reviewed By: Nikhil Testing Done: Tested with vlan device with vlan-raw-device in interfaces file also reported here: https://github.com/CumulusNetworks/ifupdown2/issues/10 is_keyword was matching iface attribute 'vlan-raw-device' to the vlan keyword and dropping it from ifaceobj config. --- ifupdown/networkinterfaces.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ifupdown/networkinterfaces.py b/ifupdown/networkinterfaces.py index 193ee66..b090b2c 100644 --- a/ifupdown/networkinterfaces.py +++ b/ifupdown/networkinterfaces.py @@ -336,8 +336,8 @@ class networkInterfaces(): def _is_keyword(self, str): # The additional split here is for allow- keyword - tmp_str = str.split('-')[0] - if tmp_str in self.network_elems.keys(): + if (str in self.network_elems.keys() or + str.split('-')[0] == 'allow'): return 1 return 0