PSExtDriverTestCase: initialize variable in case of exception

Avoid the following when test_create_net_port_security_default
hits an exception before variable network is set:

UnboundLocalError: local variable 'network' referenced before assignment

Related changes:
 - https://review.opendev.org/#/c/188209/
 - https://review.opendev.org/#/c/679399/

Change-Id: I494916567a4df2bef410e8dc54505c289bd55a61
This commit is contained in:
Flavio Fernandes 2019-10-30 17:37:27 -04:00
parent 843b5ffd9a
commit cc3886fd78

View File

@ -41,6 +41,7 @@ class PSExtDriverTestCase(test_plugin.Ml2PluginV2TestCase,
'shared': False,
'admin_state_up': True,
'status': 'ACTIVE'}}
network = None
try:
network = _core_plugin.create_network(admin_ctx, args)
_value = network[psec.PORTSECURITY]