diff --git a/network/nxos/nxos_bgp.py b/network/nxos/nxos_bgp.py index 5cdf85d8e54..682cf9fcb3e 100644 --- a/network/nxos/nxos_bgp.py +++ b/network/nxos/nxos_bgp.py @@ -654,7 +654,10 @@ class CustomNetworkConfig(object): for item in self.items: for regexp in patterns: - string = item.text if ignore_whitespace is True else item.raw + if ignore_whitespace is True: + string = item.text + else: + string = item.raw if regexp.search(item.text): if item.text != replace: if parents == [p.text for p in item.parents]: