Browse Source

Merge "use the better way to handle the not found exception"

changes/07/554407/1
Zuul 3 years ago
committed by Gerrit Code Review
parent
commit
1910c7453c
2 changed files with 5 additions and 10 deletions
  1. +2
    -8
      tricircle/network/central_plugin.py
  2. +3
    -2
      tricircle/network/local_plugin.py

+ 2
- 8
tricircle/network/central_plugin.py View File

@ -559,10 +559,6 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2,
return policy['id'] if policy else None
def get_network(self, context, network_id, fields=None):
delete = False
if network_id.endswith('_delete'):
delete = True
network_id = network_id[0: network_id.find('_delete')]
dict_para = {'resource_id': network_id, 'resource_type': 'network'}
try:
@ -570,10 +566,8 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2,
except t_exceptions.ResourceIsInDeleting():
return network_id
except t_exceptions.ResourceNotFound:
if delete:
pass
else:
raise exceptions.NotFound()
raise exceptions.NotFound()
net = super(TricirclePlugin, self).get_network(context, network_id,
fields)


+ 3
- 2
tricircle/network/local_plugin.py View File

@ -182,9 +182,10 @@ class TricirclePlugin(plugin.Ml2Plugin):
t_ctx = t_context.get_context_from_neutron_context(context)
if self._skip_non_api_query(t_ctx):
return []
para = network['id'] + '_delete'
t_network = self.neutron_handle.handle_get(
t_ctx, 'network', para)
t_ctx, 'network', network['id'])
if not t_network:
return []
return self._ensure_subnet(context, t_network)
if not subnet_ids:
return []


Loading…
Cancel
Save