diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-01-12 17:04:53 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-01-12 17:05:45 +0100 |
commit | 92add34ea4a7e108bc92457393d39bc5af5f671f (patch) | |
tree | 757a5823cbb7e0f65f4c45694488e4dbcb16134e /src | |
parent | f493df24ba29472735b1a4a081d0fce409b70d9f (diff) | |
download | vyos-1x-92add34ea4a7e108bc92457393d39bc5af5f671f.tar.gz vyos-1x-92add34ea4a7e108bc92457393d39bc5af5f671f.zip |
bgp: T2174: bail out early if config node does not exist
Diffstat (limited to 'src')
-rwxr-xr-x | src/conf_mode/protocols_bgp.py | 9 |
1 files 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. |