From baade8815bd18af7d0c64985fdb97bcad045432b Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 19 Feb 2021 21:39:10 +0100 Subject: bgp: T3332: fix UnboundLocalError when using route-reflector-client local variable 'peer_group' referenced before assignment. --- src/conf_mode/protocols_bgp.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/conf_mode/protocols_bgp.py') 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 []: -- cgit v1.2.3