From 92add34ea4a7e108bc92457393d39bc5af5f671f Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 12 Jan 2021 17:04:53 +0100 Subject: bgp: T2174: bail out early if config node does not exist --- src/conf_mode/protocols_bgp.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/conf_mode/protocols_bgp.py b/src/conf_mode/protocols_bgp.py index 678be5066..4a8a39aec 100755 --- a/src/conf_mode/protocols_bgp.py +++ b/src/conf_mode/protocols_bgp.py @@ -36,12 +36,9 @@ def get_config(): # XXX: any reason we can not move this into the FRR template? # we shall not call vtysh directly, especially not in get_config() - if not conf.exists(base): - bgp = {} - call('vtysh -c \"conf t\" -c \"no ip protocol bgp\" ') - - if not conf.exists(base + ['route-map']): - call('vtysh -c \"conf t\" -c \"no ip protocol bgp\" ') + if not conf.exists(base) or not conf.exists(base + ['route-map']): + call('vtysh -c \"conf t\" -c \"no ip protocol bgp\"') + return bgp # We also need some additional information from the config, # prefix-lists and route-maps for instance. -- cgit v1.2.3