Stop using sys.exc_clear as it is not supported in python3
Change-Id: Ic0a37116e31fb41919bc2d84d9d609127a97a3c1
This commit is contained in:
parent
5d2837c83a
commit
56154b9eed
@ -12,8 +12,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import sys
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
@ -144,8 +142,6 @@ def delete_v_resources(context, objects):
|
||||
try:
|
||||
get_object(context, obj['id'])
|
||||
except exceptions.NotFound:
|
||||
# prevent logger from logging this exception
|
||||
sys.exc_clear()
|
||||
continue
|
||||
|
||||
try:
|
||||
@ -198,8 +194,7 @@ def create_t_resources(context, objects, ext_net):
|
||||
try:
|
||||
get_object(context, obj['id'])
|
||||
except exceptions.NotFound:
|
||||
# prevent logger from logging this exception
|
||||
sys.exc_clear()
|
||||
pass
|
||||
else:
|
||||
# already exists (this will happen if we rerun from files,
|
||||
# or if the deletion failed)
|
||||
@ -321,8 +316,7 @@ def create_t_resources(context, objects, ext_net):
|
||||
context, {'security_group_rule': rule_data})
|
||||
except ext_sg.SecurityGroupRuleExists:
|
||||
# default rules were already created.
|
||||
# prevent logger from logging this exception
|
||||
sys.exc_clear()
|
||||
pass
|
||||
except Exception as e:
|
||||
LOG.error(
|
||||
">>Failed to create security group %(name)s "
|
||||
@ -401,7 +395,6 @@ def migrate_v_project_to_t(resource, event, trigger, **kwargs):
|
||||
default="yes")
|
||||
file.close()
|
||||
except Exception:
|
||||
sys.exc_clear()
|
||||
if from_file:
|
||||
LOG.error("Cannot run from file: files not found")
|
||||
return
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
|
||||
import pprint
|
||||
import sys
|
||||
|
||||
from neutron_lib import context as n_context
|
||||
from oslo_config import cfg
|
||||
@ -282,8 +281,6 @@ def nsx_recreate_dhcp_edge_by_net_id(net_id):
|
||||
nsxv_manager.vcns.get_edge(edge_id)
|
||||
except exceptions.ResourceNotFound:
|
||||
# No edge on backend
|
||||
# prevent logger from logging this exception
|
||||
sys.exc_clear()
|
||||
LOG.info("Edge %s does not exist on the NSX", edge_id)
|
||||
else:
|
||||
LOG.warning("Network %(net_id)s already has a dhcp edge: "
|
||||
|
@ -13,7 +13,6 @@
|
||||
# under the License.
|
||||
|
||||
import re
|
||||
import sys
|
||||
import xml.etree.ElementTree as et
|
||||
|
||||
from neutron_lib.callbacks import registry
|
||||
@ -284,7 +283,6 @@ def delete_nsx_portgroups(resource, event, trigger, **kwargs):
|
||||
except Exception as e:
|
||||
LOG.error("Failed to delete portgroup %(pg)s: %(e)s",
|
||||
{'pg': portgroup['moref'], 'e': e})
|
||||
sys.exc_clear()
|
||||
else:
|
||||
LOG.info("Successfully deleted portgroup %(pg)s",
|
||||
{'pg': portgroup['moref']})
|
||||
|
@ -12,8 +12,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import sys
|
||||
|
||||
from vmware_nsx.db import db as nsx_db
|
||||
from vmware_nsx.plugins.nsx_v3 import utils as v3_utils
|
||||
from vmware_nsx.shell.admin.plugins.common import constants
|
||||
@ -100,8 +98,6 @@ def delete_backend_network(resource, event, trigger, **kwargs):
|
||||
try:
|
||||
nsxlib.logical_switch.get(nsx_id, silent=True)
|
||||
except nsx_exc.ResourceNotFound:
|
||||
# prevent logger from logging this exception
|
||||
sys.exc_clear()
|
||||
LOG.warning("Backend network %s was not found.", nsx_id)
|
||||
return
|
||||
|
||||
@ -118,8 +114,6 @@ def delete_backend_network(resource, event, trigger, **kwargs):
|
||||
try:
|
||||
nsxlib.logical_switch.get(nsx_id, silent=True)
|
||||
except nsx_exc.ResourceNotFound:
|
||||
# prevent logger from logging this exception
|
||||
sys.exc_clear()
|
||||
LOG.info("Backend network %s was deleted.", nsx_id)
|
||||
else:
|
||||
LOG.error("Failed to delete backend network %s.", nsx_id)
|
||||
|
@ -12,8 +12,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import sys
|
||||
|
||||
from neutron.db import db_base_plugin_v2
|
||||
from neutron.db import l3_db
|
||||
from neutron_lib.callbacks import registry
|
||||
@ -176,8 +174,6 @@ def delete_backend_router(resource, event, trigger, **kwargs):
|
||||
try:
|
||||
nsxlib.logical_router.get(nsx_id, silent=True)
|
||||
except nsx_exc.ResourceNotFound:
|
||||
# prevent logger from logging this exception
|
||||
sys.exc_clear()
|
||||
LOG.warning("Backend router %s was not found.", nsx_id)
|
||||
return
|
||||
|
||||
@ -193,8 +189,6 @@ def delete_backend_router(resource, event, trigger, **kwargs):
|
||||
try:
|
||||
nsxlib.logical_router.get(nsx_id, silent=True)
|
||||
except nsx_exc.ResourceNotFound:
|
||||
# prevent logger from logging this exception
|
||||
sys.exc_clear()
|
||||
LOG.info("Backend router %s was deleted.", nsx_id)
|
||||
else:
|
||||
LOG.error("Failed to delete backend router %s.", nsx_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user