summaryrefslogtreecommitdiff
path: root/src/conf_mode/protocols_bgp.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-02-19 21:39:10 +0100
committerChristian Poessinger <christian@poessinger.com>2021-02-19 21:39:10 +0100
commitbaade8815bd18af7d0c64985fdb97bcad045432b (patch)
tree96f3c98431d94b1f3c5f755154f680791a28a4bd /src/conf_mode/protocols_bgp.py
parent4ef293430ac0c7a4679ca028269f0579ca0cfa94 (diff)
downloadvyos-1x-baade8815bd18af7d0c64985fdb97bcad045432b.tar.gz
vyos-1x-baade8815bd18af7d0c64985fdb97bcad045432b.zip
bgp: T3332: fix UnboundLocalError when using route-reflector-client
local variable 'peer_group' referenced before assignment.
Diffstat (limited to 'src/conf_mode/protocols_bgp.py')
-rwxr-xr-xsrc/conf_mode/protocols_bgp.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/conf_mode/protocols_bgp.py b/src/conf_mode/protocols_bgp.py
index b5bb018ae..baf5c4159 100755
--- a/src/conf_mode/protocols_bgp.py
+++ b/src/conf_mode/protocols_bgp.py
@@ -142,10 +142,10 @@ def verify(bgp):
if 'remote_as' in peer_config and asn != peer_config['remote_as']:
raise ConfigError('route-reflector-client only supported for iBGP peers')
else:
- peer_group_as = dict_search(f'peer_group.{peer_group}.remote_as', asn_config)
- if 'peer_group' in peer_config and peer_group_as != None and peer_group_as != asn:
- raise ConfigError('route-reflector-client only supported for iBGP peers')
-
+ if 'peer_group' in peer_config:
+ peer_group_as = dict_search(f'peer_group.{peer_group}.remote_as', asn_config)
+ if peer_group_as != None and peer_group_as != asn:
+ raise ConfigError('route-reflector-client only supported for iBGP peers')
# Throw an error if a peer group is not configured for allow range
for prefix in dict_search('listen.range', asn_config) or []: